API: Payment Methods
Payment Methods in Recharge are references to credit cards stored securely on the payment gateway. They can be used for one-time or recurring charges.
Recharge supports an unlimited number of Payment Methods for each customer.
Since they are stored securely on the gateway, Payment Methods cannot be edited. If a customer changes credit card information, you must add a new Payment Method to Recharge and apply the new Payment Method to the Customer's Charge.
Payment Method Attributes
|id||The unique identifier for the Payment Method.|
|customer||ID of the Customer that the new Payment Method should be added to.|
|nameOnCard||Name printed on the front of the card.|
|cardNumber||Credit card number.|
|expDate||Credit card expiration date. Formatted like "MMYY"|
|cvv2||3 or 4 digit security code. (Optional)|
|address||Cardholder address used for AVS verification. (Optional)|
|zip||Cardholder ZIP code used for AVS verification. (Optional)|
|alias||The credit card alias used by the gateway.|
|cardType||Credit card type.|
|last4||Last 4 numbers of the stored credit card.|
Create Payment Method
Creates a new Payment Method in Recharge, assigns it to a Customer and returns information about it.
$fields['customer'] = "cu4ea20c9a6724b"; $fields['nameOnCard'] = "Test Jones"; $fields['cardNumber'] = "4111111111111111"; $fields['expDate'] = "0920"; $fields['cvv2'] = "123"; $fields['address'] = "123 Any Street"; $fields['zip'] = "90210";
<payMethod id="pm4ea20d4819c18"> <id>pm4ea20d4819c18</id> <customer>cu4ea20c9a6724b</customer> <alias>ZVsWFU6Ip0</alias> <cardType>Visa</cardType> <last4>1111</last4> <expDate>0920</expDate> <nameOnCard>Test Jones</nameOnCard> </payMethod>
Delete Payment Method
Deletes the Payment Method from Recharge only if it is not being used for any recurring charges.