# Payment Methods
Payment Methods are saved card or bank account connections. They can be standalone or associated to customer.
# Create Payment Method
Create a standalone Payment Method that you can later use to Create a Charge.
POST https://<org-uuid>.production.tratta.io/api/v1/payment-methods
curl https://<org-uuid>.production.tratta.io/api/v1/payment-methods \
-H "Authorization: Bearer eyJ0eXA3asdk..." \
-d card[card_holder]="Card Holder" \
-d card[card_number]="4242424242424242" \
-d card[card_expiration_month]="12" \
-d card[card_expiration_year]="23" \
-d card[card_security_code]="123"
-X POST
# Parameters
card json object with paramters
- card_holder
required without ach
- card_number
required without ach|valid card number
- card_expiration_month
required without ach|numeric|between:1,12
- card_expiration_year
required without ach|last 2 digits of a year
- card_security_code
optional
- card_postal_code
optional|5 digits
ach json object with parameters
account_holder
required without card
account_type
required without card|in:checking, savings
Checking or Savings account type.
ownership_type
optional in:personal, business
Specifies the ownership type of the account. Default is
personal
.If
business
is selected, the SEC code will be set toCCD
. Otherwise,WEB
will be used.routing_number
required without card|valid routing number
account_number
required without card|min:4|max:17
account_zip
required without card|5 digits
Specifies the Postal code of the account.
account_state
required without card
# Returns for Card
A json with data
property that contains created payment-method
object.
{
"id": "uuid",
"type": "card",
"card_token": {
"card_holder": "string",
"card_number": "last4",
"expiration_month": "12",
"expiration_year": "2024",
"card_type": "Visa",
"card_zip": "10001"
},
"is_primary": false
}
# Returns for ACH
A json with data
property that contains created payment-method
object.
{
"id": "uuid",
"type": "card",
"bank_account": {
"account_holder": "string",
"account_type": "string",
"routing_number": "string",
"account_number": "string",
"account_zip": "10001",
"account_state": "NY"
}
}
# Update Payment Method
PUT https://<org-uuid>.production.tratta.io/api/v1/payment-methods/{payment-method-uuid}
curl https://<org-uuid>.production.tratta.io/api/v1/payment-methods/{payment-method-uuid} \
-H "Authorization: Bearer eyJ0eXA3asdk..." \
-d is_primary="true" \
-X PUT
# Parameters
is_primary required|boolean
Setting payment method as primary sets any other payment method is_primary
to false
.
# Returns
A json with data
property that contains created payment-method
object.
{
"id": "uuid",
"type": "card",
"card_token": {
"card_holder": "string",
"card_number": "last4",
"expiration_month": "12",
"expiration_year": "2024",
"card_type": "Visa",
"card_zip": "10001"
},
"billing_address": {
// Customer address
},
"is_primary": false
}
# Attach Customer Address
PUT https://<org-uuid>.production.tratta.io/api/v1/payment-methods/{payment-method-uuid}/address
curl https://<org-uuid>.production.tratta.io/api/v1/payment-methods/{payment-method-uuid}/address \
-H "Authorization: Bearer eyJ0eXA3asdk..." \
-d billing_address_id="1234-1234-1234" \
-X PUT
# Parameters
billing_address_id required|exists
Existing Customer Address uuid.
# Returns
A json with data
property that contains created payment-method
object.
{
"id": "uuid",
"type": "card",
"card_token": {
"card_holder": "string",
"card_number": "last4",
"expiration_month": "12",
"expiration_year": "2024",
"card_type": "Visa",
"card_zip": "10001"
},
"billing_address": {
// Customer address
},
"is_primary": false
}
# Detach Customer Address
DELETE https://<org-uuid>.production.tratta.io/api/v1/payment-methods/{payment-method-uuid}/address/{address-uuid}
curl https://<org-uuid>.production.tratta.io/api/v1/payment-methods/{payment-method-uuid}/address/{address-uuid} \
-H "Authorization: Bearer eyJ0eXA3asdk..."
# Returns
A json with data
property that contains created payment-method
object.
{
"id": "uuid",
"type": "card",
"card_token": {
"card_holder": "string",
"card_number": "last4",
"expiration_month": "12",
"expiration_year": "2024",
"card_type": "Visa",
"card_zip": "10001"
},
"billing_address": {
// Customer address
},
"is_primary": false
}