- API Introduction
- Error Code
- Payment Intents
- Charges
- Payment Methods
- Refunds
- Webhooks
- Events
- Files
- Disputes
- Payouts
- Balance
- Products
- Prices
- Payment Links
- Checkout
- Customers
- Setup Intents
- Invoices
- Invoice Items
- Invoice Line Item
- Subscriptions
- Subscription Items
- Issuing
- Authorizations
- Cardholders
- Cards
- Transactions
- Coupons
- Promotion Code
- Accounts
Attach a PaymentMethod to a Customer
POST
/v1/payment_methods/{paymentmethod_id}/attach
To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntent or a PaymentIntent with setup_future_usage. These approaches will perform any necessary steps to set up the PaymentMethod for future payments.
Request
Authorization
Send your HTTP requests with an
Authorization
header that contains the word Basic followed by a space and a base64-encoded string {{Username}}:{{Password}}Example:
Authorization: Basic YWRtaW46MTIzNDU2
Path Params
paymentmethod_id
string
required
Header Params
Accept
string
required
Default:
application/json
Content-Type
string
required
Default:
application/json
Body Params application/json
customer
string
required
Example
{
"customer": "string"
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://apitest.wooshpay.com/v1/payment_methods//attach?members&reference&Type&_postman_listIndexKey=key&_postman_listAllowsMultipleValues' \
--data-raw ''
Responses
🟢200OK
application/json
Body
id
string
optional
object
string
optional
created
integer
optional
customer
string
optional
metadata
object
optional
livemode
boolean
optional
billing_details
object (Billing Details)
optional
address
object (Address)
optional
email
string
optional
name
string
optional
phone
string
optional
type
enum<string>
required
Allowed values:
cardalipayplusalipaywechat_paysepa_debitalipay_hkboosttruemoneygcashkakaopaytouchngorabbit_line_paydanaklarnaidealgiropaysofortepstrustlybancontactp24unionpayfpxmcashgrabpaybank_transfer_idqrispromptpayovoshopeepayupiboletopaynowpix9paystitchbpi
card
object
optional
brand
string
optional
checks
object
optional
country
string
optional
exp_month
integer
optional
exp_year
integer
optional
fingerprint
string
optional
funding
string
optional
last4
string
optional
metadata
object
optional
Example
{
"id": "string",
"object": "string",
"created": 0,
"customer": "string",
"metadata": {},
"livemode": true,
"billing_details": {
"address": {
"city": "string",
"country": "string",
"line1": "string",
"line2": "string",
"postal_code": "string",
"state": "string"
},
"email": "string",
"name": "string",
"phone": "string"
},
"type": "card",
"card": {
"brand": "string",
"checks": {
"address_line1_check": "string",
"address_zip_check": "string",
"cvc_check": "string"
},
"country": "string",
"exp_month": 0,
"exp_year": 0,
"fingerprint": "string",
"funding": "string",
"last4": "string",
"metadata": {}
}
}
Modified at 2024-07-04 03:28:33