Create a payment method

post/payment_methods

The POST /payment_methods call allows your platform to create a payment method. Payment methods represent payment data like credit cards and bank accounts, and allow your platform to charge and accept money from a payer.

SecurityappIdAuth and appTokenAuth
Request
header Parameters
Api-Version
required
string
Example: 3.0
Content-Type
required
stringapplication/json
Example: application/json
Unique-Key
string
WePay-Risk-Token
string

This header is required when tokenizing Payment Methods, Legal Entities, and Payout Methods when the tokenization JS library is not being used.

Client-IP
string

This header is required when tokenizing Payment Methods, Legal Entities, and Payout Methods when the tokenization JS library is not being used.

Request Body schema: application/json
type
required
string

Type of payment method. Possible values include: credit_card, payment_bank_us, payment_method_id, encoded_payment_method.

Enum: Description
credit_card

This value is required if the credit_card structure is being sent with raw credit card data.

payment_bank_us

This value is required if the payment_bank_us structure is being sent with the raw bank account data.

… 3 more
object

Raw credit card information.

object or null

Any custom data your platform chooses to attach to this resource. The custom data must be key-value pairs and not contain any personally identifiable information (PII) or payment card (PCI) data.

encoded_payment_method
string [ 1 .. 2048 ] characters

Encoded payment data. Currently is used for POS payment tokens but in future may be used for other types of encoded payment information

object

Raw bank account information.

Array of objects or null

Any rbit data your platform chooses to attach to this resource. The rbit data must be key-value pairs and can be an array of rbit objects.

object

A previously created token. Note: Using tokens to pass highly-sensitive data directly to WePay may help your platform avoid certain compliance and regulatory overhead. Learn more about tokens here.

Responses
201
Response Schema: application/json
id
required
string

ID of the payment method, generated by WePay when the payment method is created.

resource
required
string

Helps organize information by identifying the resource type of the object data.

Value: Description
payment_methods
path
required
string

Path of resource and resource ID.

required
object

Details the owner resource and owner path.

create_time
required
integer <int64> >= 0
type
required
string

Type of payment method. Possible values include: credit_card, payment_bank_us, payment_method_id, encoded_payment_method.

Enum: Description
credit_card

This value is required if the credit_card structure is being sent with raw credit card data.

payment_bank_us

This value is required if the payment_bank_us structure is being sent with the raw bank account data.

… 3 more
status
required
string

Possible values include: deleted, unverified, verification_failed, verified.

Enum: Description
unverified

This payment method has not been verified yet and cannot be used to create payments until the status updates to verified.

verified

This payment method has successfully been verified and can now be used to create payments.

… 2 more
api_version
string
object

Raw credit card information.

object or null

Any custom data your platform chooses to attach to this resource. The custom data must be key-value pairs and not contain any personally identifiable information (PII) or payment card (PCI) data.

object

Raw bank account information.

400

INVALID_PARAMS, MERCHANT_ACCOUNT_CANNOT_ACCEPT_PAYMENTS

403

NOT_AUTHORIZED

500

UNEXPECTED_ERROR

Request samples
application/json
{
  • "credit_card": {
    • "auto_update": false,
    • "card_holder": {
      • "address": {
        • "country": "US",
        • "postal_code": "94025"
        },
      • "email": "example@wepay.com",
      • "holder_name": "John Snow"
      },
    • "card_number": "5496198584584769",
    • "cvv": "007",
    • "expiration_month": 4,
    • "expiration_year": 2020,
    • "trigger_verification": true,
    • "virtual_terminal_mode": "mobile",
    • "card_on_file": false,
    • "recurring": false
    },
  • "custom_data": {
    • "my_key": "invoice #54321"
    },
  • "type": "credit_card"
}
Response samples
application/json
{
  • "create_time": 1512429148,
  • "credit_card": {
    • "auto_update": false,
    • "backing_display_name": null,
    • "bin": "549619",
    • "card_brand": "mastercard",
    • "card_entry_type": "card_keyed",
    • "card_holder": {
      • "address": {
        • "city": "",
        • "country": "US",
        • "line1": "",
        • "line2": "",
        • "postal_code": "94025",
        • "region": ""
        },
      • "email": "example@wepay.com",
      • "holder_name": "John Snow",
      • "phone": {
        • "country_code": null,
        • "phone_number": null,
        • "type": null
        }
      },
    • "display_name": "MasterCard xxxxxx4769",
    • "expiration_month": 4,
    • "expiration_year": 2020,
    • "last_four": "4769",
    • "virtual_terminal_mode": null,
    • "card_on_file": false,
    • "recurring": false,
    • "cvv_provided": true
    },
  • "custom_data": null,
  • "id": "00000000-6363-0000-0000-0000cd225fe1",
  • "owner": {
    • "id": "171845",
    • "path": null,
    • "resource": "applications"
    },
  • "path": "/payment_methods/00000000-6363-0000-0000-0000cd225fe1",
  • "resource": "payment_methods",
  • "status": "verified",
  • "type": "credit_card",
  • "api_version": "3.0"
}