Payment Profiles

Create Payment Profile

POST
/payment_profiles.json

Creates a payment profile for a customer.

When you create a new payment profile for a customer via the API, it does not automatically make the profile current for any of the customer’s subscriptions. To use the payment profile as the default, you must set it explicitly for the subscription or subscription group.

Select an option from the Request Examples drop-down on the right side of the portal to see examples of common scenarios for creating payment profiles.

Do not use real card information for testing. See the Sites articles that cover testing your site setup for more details on testing in your sandbox.

Note that collecting and sending raw card details in production requires PCI compliance on your end. If your business is not PCI compliant, use Maxio.js (formerly Chargify.js) to collect credit card or bank account information.

See the following articles to learn more about subscriptions and payments:

3D Secure (3DS) Authentication post-authentication flow

When a payment requires 3DS Authentication to adhere to Strong Customer Authentication (SCA), the request enters a post-authentication flow where a 422 Unprocessable Entity status is returned with an action_link that will direct the customer through 3DS Authentication.

See the 3D Secure Post-Authentication Flow article in the product documentation to learn how to manage the redirect flow.

Authorization

BasicAuth
AuthorizationBasic <token>

The username is a Maxio Chargify API key. The password is x.

In: header

Request Body

application/json

When following the IBAN or the Local Bank details examples, a customer, bank account and mandate will be created in your current vault. If the customer, bank account, and mandate already exist in your vault, follow the Import example to link the payment profile into Advanced Billing.

payment_profile*

Response Body

application/json

application/json

curl -X POST "https://example.com/payment_profiles.json" \  -H "Content-Type: application/json" \  -d '{    "payment_profile": {      "customer_id": 1036,      "chargify_token": "tok_w68qcpnftyv53jk33jv6wk3w"    }  }'
{  "payment_profile": {    "first_name": "Jessica",    "last_name": "Test",    "card_type": "visa",    "masked_card_number": "XXXX-XXXX-XXXX-1111",    "expiration_month": 10,    "expiration_year": 2018,    "customer_id": 19195410,    "current_vault": "bogus",    "vault_token": "1",    "billing_address": "123 Main St.",    "billing_city": "Boston",    "billing_state": "MA",    "billing_zip": "02120",    "billing_country": "US",    "customer_vault_token": null,    "billing_address_2": null,    "payment_type": "credit_card",    "site_gateway_setting_id": 1,    "gateway_handle": "handle",    "disabled": false  }}