Core Resources
Payment methods
The
Important - If you see the following error when accessing Payment Methods endpoints: "You do not have sufficient permissions (scopes) for this object", the token you are using has not been configured with correct access permissions. Update the token to have "Read access" or "Read and Write access" depending on your use case.
Payment Method object holds payment and billing information. A Customer may be associated with many Payment Methods, and an Addresses record must be associated with at least one Payment_method.Important - If you see the following error when accessing Payment Methods endpoints: "You do not have sufficient permissions (scopes) for this object", the token you are using has not been configured with correct access permissions. Update the token to have "Read access" or "Read and Write access" depending on your use case.
29 additions in V2, marked New
Everything marked New also works when you send X-Recharge-Version: 2021-11.

#The payment method object
The Payment Method object holds payment and billing information. A
Customer may be associated with many payment methods, and an Addresses record must be associated with at least one Payment Method.Attributes
- idintegerThe unique payment method id for a customer.
- customer_idintegerThe Recharge
customer_id. - An object containing the related resources requested with the
includequery parameter. Returned as an empty object when no related resources are requested. - The date and time when the payment method was deleted.
nullfor payment methods that have not been deleted.Only returned by the list endpoint wheninclude_deleted=trueis passed. - created_atdatetimeThe date and time when the payment method was created.
- defaultboolean
trueif this is default payment method for the Customer.To update thePayment Methodthat will be used for processing charges for a specificAddress, use Update an address method with apayment_method_id. - payment_detailsobjectDetails about the specific payment method. The keys returned depend on
payment_type:CREDIT_CARDandAMAZON_PAYreturnbrand,last4,exp_monthandexp_year(pluswallet_typeandfunding_typewhen available);APPLE_PAYandGOOGLE_PAYreturnbrand,last4,exp_monthandexp_year;SEPA_DEBITreturnsbank_code,country,external_mandate_idandlast4;PAYPALreturnspaypal_emailandpaypal_payer_id.Those details will vary based on thepayment_typeShow child attributesHide child attributes113 new
- The bank code of the account.Only returned when
payment_typeisSEPA_DEBIT. - brandstring
Payment_methodbrand or company powering it.valid forCREDIT_CARDonly. - The country of the bank account.Only returned when
payment_typeisSEPA_DEBIT. - exp_monthinteger
Payment_methodexpiry month.valid forCREDIT_CARDonly. - exp_yearinteger
Payment_methodexpiry year.valid forCREDIT_CARDonly. - The ID of the debit mandate at the processor.Only returned when
payment_typeisSEPA_DEBIT. - last4stringlast 4-digits of the identifier.valid for
CREDIT_CARDonly. - paypal_emailstringemail linked to .valid for
PAYPALonly. - paypal_payer_idstringpaypal user identifier.valid for
PAYPALonly. - wallet_typestringIf a digital wallet.
- funding_typestringType of funding for the
Payment Method.
- payment_typestringThe type of payment this is.Possible values
CREDIT_CARDPAYPALAPPLE_PAYGOOGLE_PAYSEPA_DEBITIDEALSHOP_PAYPAYPAL_EXPRESSSOFORTGIROPAYAMAZON_PAYINVOICEAFTERPAY_CLEARPAYKLARNAIf passed, must also be accompanied by one ofstripe_customer_token,paypal_customer_tokenorauthorizedotnet_customer_tokeninprocessor_payment_method_token. - processor_customer_tokenstringThe customer token at the processor.
- processor_namestringThis will impact validation on billing_details.Possible values
stripebraintreeauthorizeshopify_paymentsmolliecustom_gatewayCurrently,shopify_paymentsis in read-only mode and can only be managed by Shopify. - The payment token at the processor.
- statusstringState of the
Payment Method.Possible valuesunvalidatedvalidinvalidempty - status_reasonstringThe status reason for the payment method.Often used when
invalidto provide background details in invalidity. - updated_atdatetimeLast time the
Payment_methodwas updated. - billing_addressobjectAn object with the customer’s address information.
Show child attributesHide child attributes111 new
- address1stringLine one of the billing address.
- address2stringLine two of the billing address.
- citystringThe city of the billing address.
- companystringThe company name of the billing address.
- The full country name of the billing address.
- country_codestring2-letter country code.
- first_namestringThe first name of the billing address.
- last_namestringThe last name of the billing address.
- phonestringThe phone number of the billing address.
- provincestringThe name of the province or state associated with the billing address.
- zipstringThe zip code or postcode of the address.
{
"payment_method": {
"id": 1234567,
"customer_id": 62459147,
"billing_address": {
"address1": "123 Washington Street",
"address2": "Suite 101",
"city": "Los Angeles",
"company": "Recharge",
"country": "United States",
"country_code": "US",
"first_name": "Jane",
"last_name": "Doe",
"phone": "1234567890",
"province": "California",
"zip": "90210"
},
"created_at": "2018-11-14T09:00:01",
"default": true,
"payment_details": {
"brand": "visa",
"exp_month": 12,
"exp_year": 2021,
"last4": 1234
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "cus_AB3ebcBaL6pCx9",
"processor_name": "stripe",
"processor_payment_method_token": "pm_1LdKdfj2zqHvUId1uGheBEHy",
"retry_date": null,
"status": null,
"status_reason": null,
"taxable": true,
"updated_at": "2018-11-14T09:00:01"
}
}#Create a payment method
POST/payment_methods
Create a Payment Method in Recharge.
Scope
write_payment_methodsWhen
processor_name is mollie, the required fields are customer_id, processor_name and processor_payment_method_token. processor_customer_token is optional when processor_payment_method_token is passed. If billing_address is omitted, the billing address of the customer is used. A 429 is returned when the store limits how many payment methods a customer can add.Body parameters
- A list of
AddressIDs to associate with the new payment method. IDs that do not belong to the customer are ignored. - If
true, the new payment method is associated with all of the addresses of the customer. - The Recharge
customer_id. trueif this is default payment method for the Customer.- Details about the specific payment method. Accepts
brand,last4,exp_month,exp_year,paypal_email,paypal_payer_id,wallet_typeandfunding_type. For other processors the details are retrieved from the processor and this value is ignored.Only applied whenprocessor_nameiscustom_gatewayorauthorize, or whenpayment_typeisPAYPAL_EXPRESS. - The type of payment.Possible values
CREDIT_CARDPAYPALAPPLE_PAYGOOGLE_PAYSEPA_DEBITIDEALSHOP_PAYPAYPAL_EXPRESSSOFORTGIROPAYAMAZON_PAYINVOICEAFTERPAY_CLEARPAYKLARNA - processor_customer_tokenstringThe customer token at the processor.On Stripe this begins with
cus_. - This will impact validation on billing_details.Possible values
stripebraintreeauthorizeshopify_paymentsmolliecustom_gatewayCurrently,shopify_paymentsis in read-only mode and can only be managed by Shopify. - The payment token at the processor.
- billing_addressobjectAn object with the customer’s address information.
Show child attributesHide child attributes111 new
- Line one of the billing address.
- address2stringLine two of the billing address.
- The city of the billing address.
- companystringThe company name of the billing address.
- The full country name of the billing address. Either
countryorcountry_codeis required whenbilling_addressis passed. - country_codestring2-letter country code.
- first_namestringThe first name of the billing address.
- last_namestringThe last name of the billing address.
- phonestringThe phone number of the billing address.
- provincestringThe name of the province or state associated with the billing address.
- zipstringThe zip code or postcode of the address.
- retry_chargesbooleanWhether charges associated with this payment method should be retried. If
truethen charges with previous payment-related errors will be set to retry during the next automated processing.
curl -X POST 'https://api.rechargeapps.com/payment_methods' \
-H 'X-Recharge-Version: v2' \
-H 'Content-Type: application/json' \
-H 'X-Recharge-Access-Token: your_api_token' \
-d '{
"customer_id": 62824147,
"default": true,
"payment_type": "CREDIT_CARD",
"processor_customer_token": "cus_JGYtLWi2HS8ymD",
"processor_name": "stripe",
"processor_payment_method_token": "pm_34jdshjs"
}'{
"payment_method": {
"id": 1234567,
"customer_id": 62459147,
"billing_address": {
"address1": "123 Washington Street",
"address2": "Suite 101",
"city": "Los Angeles",
"company": "Recharge",
"country": "United States",
"country_code": "US",
"first_name": "Jane",
"last_name": "Doe",
"phone": "1234567890",
"province": "California",
"zip": "90210"
},
"created_at": "2018-11-14T09:00:01",
"default": true,
"payment_details": {
"brand": "visa",
"exp_month": 12,
"exp_year": 2021,
"last4": "1234"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "cus_AB3457BaL90Cx9",
"processor_name": "stripe",
"processor_payment_method_token": "pm_1LdKdfj2zqHvUId1uGheBEHy",
"status": null,
"status_reason": null,
"updated_at": "2018-11-14T09:00:01"
}
}#Retrieve a payment method
GET/payment_methods/{id}
Retrieve an existing
Payment Method using the Recharge Payment Method id.Scope
read_payment_methodsQuery parameters
- A comma-separated list of related resources to return in the
includeobject of the payment method. Both values require theread_customersscope.Possible valuesaddressescustomer - If
true, a deleted payment method can be retrieved.
curl 'https://api.rechargeapps.com/payment_methods/1234567' \
-H 'X-Recharge-Version: v2' \
-H 'X-Recharge-Access-Token: your_api_token'{
"payment_method": {
"id": 1234567,
"customer_id": 62459147,
"billing_address": {
"address1": "123 Washington Street",
"address2": "Suite 101",
"city": "Los Angeles",
"company": "Recharge",
"country": "United States",
"country_code": "US",
"first_name": "Jane",
"last_name": "Doe",
"phone": "1234567890",
"province": "California",
"zip": "90210"
},
"created_at": "2018-11-14T09:00:01",
"default": true,
"payment_details": {
"brand": "visa",
"exp_month": 12,
"exp_year": 2021,
"last4": "1234"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "cus_AB3457BaL90Cx9",
"processor_name": "stripe",
"processor_payment_method_token": "pm_1LdKdfj2zqHvUId1uGheBEHy",
"status": null,
"status_reason": null,
"updated_at": "2018-11-14T09:00:01"
}
}#Update a payment method
PUT/payment_methods/{id}
Modify an existing
Payment Method.Scope
write_payment_methodsPayment methods with a
processor_name of shopify_payments cannot be updated through this endpoint and return a 422.Body parameters
- defaultboolean
trueif this is default payment method for the Customer.To update thePayment Methodthat will be used for processing charges for a specificAddress, use Update an address method with apayment_method_id. - billing_addressobjectAn object with the customer’s address information.
Show child attributesHide child attributes111 new
- address1stringLine one of the billing address.
- address2stringLine two of the billing address.
- citystringThe city of the billing address.
- companystringThe company name of the billing address.
- The full country name of the billing address.
- country_codestring2-letter country code.
- first_namestringThe first name of the billing address.
- last_namestringThe last name of the billing address.
- phonestringThe phone number of the billing address.
- provincestringThe name of the province or state associated with the billing address.
- zipstringThe zip code or postcode of the address.
- Details about the specific payment method. Accepts
brand,last4,exp_month,exp_year,paypal_email,paypal_payer_id,wallet_typeandfunding_type.Only applied to payment methods with aprocessor_nameofcustom_gateway. - The type of payment. Must be supported by the processor of the payment method.Possible values
CREDIT_CARDPAYPALAPPLE_PAYGOOGLE_PAYSEPA_DEBITIDEALSHOP_PAYPAYPAL_EXPRESSSOFORTGIROPAYAMAZON_PAYINVOICEAFTERPAY_CLEARPAYKLARNA - The customer token at the processor. Only applied when
processor_payment_method_tokenis also passed. - The payment token at the processor. The token is validated with the processor and the payment details are refreshed from it.
- Whether charges with a previous payment failure should be retried after the payment method is updated. Defaults to
true.
curl -X PUT 'https://api.rechargeapps.com/payment_methods/1234567' \
-H 'X-Recharge-Version: v2' \
-H 'Content-Type: application/json' \
-H 'X-Recharge-Access-Token: your_api_token' \
-d '{
"default": true
}'{
"payment_method": {
"id": 1234567,
"customer_id": 62459147,
"billing_address": {
"address1": "123 Washington Street",
"address2": "Suite 101",
"city": "Los Angeles",
"company": "Recharge",
"country": "United States",
"country_code": "US",
"first_name": "Jane",
"last_name": "Doe",
"phone": "1234567890",
"province": "California",
"zip": "90210"
},
"created_at": "2018-11-14T09:00:01",
"default": true,
"payment_details": {
"brand": "visa",
"exp_month": 12,
"exp_year": 2021,
"last4": "1234"
},
"payment_type": "CREDIT_CARD",
"processor_customer_token": "cus_AB3457BaL90Cx9",
"processor_name": "stripe",
"processor_payment_method_token": "pm_1LdKdfj2zqHvUId1uGheBEHy",
"status": null,
"status_reason": null,
"updated_at": "2018-11-14T09:00:01"
}
}#Delete a payment method
DELETE/payment_methods/{id}
Permanently delete a
Payment Method.Scope
write_payment_methodscurl -X DELETE 'https://api.rechargeapps.com/payment_methods/1234567' \
-H 'X-Recharge-Version: v2' \
-H 'X-Recharge-Access-Token: your_api_token'{}#List payment methods
GET/payment_methods
Return a list of payment methods in your store.
HTTP request examples
GET /payment_methodsScope
read_payment_methodsResults are always sorted by id, newest first. The response also contains
next_cursor and previous_cursor.Query parameters
- customer_idstringGets all
Payment methodsfor this customer. - Gets all
Payment methodsassociated with thisAddress. - Filter payment methods by id. If passing multiple values, must be comma separated.
- A comma-separated list of related resources to return in the
includeobject of each payment method. Both values require theread_customersscope.Possible valuesaddressescustomer - If
true, deleted payment methods are also returned and each payment method includes adeleted_atattribute. - Filter payment methods by processor. Can only be passed together with
customer_id.Possible valuesstripebraintreeauthorizeshopify_paymentsmolliecustom_gateway - Filter payment methods by the payment token at the processor. Only applied when
customer_idis also passed. - The number of results. Default is 50, maximum is 250.
- The page to show. Default is 1.
- The cursor returned in
next_cursororprevious_cursorof a previous response. When a cursor is passed,limitis the only other parameter that can be passed with it.
curl 'https://api.rechargeapps.com/payment_methods?limit=3' \
-H 'X-Recharge-Version: v2' \
-H 'X-Recharge-Access-Token: your_api_token'{
"payment_methods": [
{
"id": 1234567,
"billing_address": {
"address1": "123 Washington Street",
"address2": "Suite 101",
"city": "Los Angeles",
"company_name": "Acme Corp",
"country": "United States",
"country_code": "US",
"name": "Jane Doe",
"phone": "1234567890",
"province": "California",
"zip": "90210"
},
"created_at": "2018-11-14T09:00:01",
"customer_id": 999123999,
"default": true,
"payment_details": [
{
"brand": "visa",
"exp_month": 12,
"exp_year": 2021,
"last4": 1234
}
],
"payment_type": "CREDIT_CARD",
"processor_customer_token": "cus_AB3ebcBaL6pCx9",
"processor_name": "stripe",
"processor_payment_method_token": "pm_123123",
"updated_at": "2018-11-14T09:00:01"
}
]
}