Billing
The Billing
functions allow you to manage an account's billing.
You can use these functions to add or delete credit cards or bank accounts, list the available payment methods, and fund a wallet.
Production OnlyThis call will only work with your Production API Key.
Important: This endpoint only works for ReferralCustomers
or to
manage Child User
accounts. If you feel this is applicable for your use case,
please contact sales.
This endpoint will create a Stripe credit card object on your behalf using EasyPost's Stripe public key, and does not require you to have a Stripe account.
Request Parameters
Possible values:
- primary
- secondary
1curl -X POST https://api.easypost.com/v2/credit_cards \
2 -u "$REFERRAL_USER_API_KEY": \
3 -H "Content-Type: application/json" \
4 -d '{
5 "credit_card": {
6 "stripe_object_id": "tok_...",
7 "priority": "primary"
8 }
9 }'
1{
2 "id": "card_...",
3 "object": "CreditCard",
4 "name": null,
5 "last4": "1234",
6 "exp_month": 1,
7 "exp_year": 2025,
8 "brand": "Visa"
9}
Production OnlyThis call will only work with your Production API Key.
Fund your EasyPost wallet by charging your primary or secondary payment method on file. The amount added must be greater than or equal to your current balance.
Adding funds with one-time charges is optional, as EasyPost uses an automatic recharge system to maintain a wallet balance.
The API response for this endpoint is empty. The functions in our client libraries will return true
if the API call succeed, or else an error will be thrown.
Request Parameters
The payment method from your account: Possible values:
- primary
- secondary
1curl -X POST https://api.easypost.com/v2/credit_cards/card_.../charges \
2 -u "EASYPOST_API_KEY": \
3 -H 'Content-Type: application/json' \
4 -d '{
5 "amount": "2000"
6 }'
1{}
Production OnlyThis call will only work with your Production API Key.
Important: This endpoint only works for ReferralCustomers
or to
manage Child User
accounts. If you feel this is applicable for your use case,
please contact sales.
Use EasyPost's Stripe Public API key to create tokens for a ReferralCustomers
on Stripe.
Please retrieve EasyPost's Stripe Public API key every time you need to create a new payment method, as we may rotate the key for security at any time.
If using one of our client libraries, this will be handled on your behalf when adding a credit card.
1curl -X GET https://api.easypost.com/v2/partners/stripe_public_key \
2 -u "$PARTNER_API_KEY":
1{
2 "public_key": "pk_..."
3}
Production OnlyThis call will only work with your Production API Key.
List payment methods associated with an account.
1curl -X GET https://api.easypost.com/v2/payment_methods \
2 -u "EASYPOST_API_KEY":
1{
2 "id": "cust_...",
3 "object": "PaymentMethods",
4 "primary_payment_method": {
5 "id": "card_...",
6 "disabled_at": null,
7 "object": "CreditCard",
8 "name": null,
9 "last4": "4242",
10 "exp_month": 1,
11 "exp_year": 2025,
12 "brand": "Visa"
13 },
14 "secondary_payment_method": {
15 "id": "card_...",
16 "disabled_at": null,
17 "object": "CreditCard",
18 "name": null,
19 "last4": "4444",
20 "exp_month": 1,
21 "exp_year": 2025,
22 "brand": "Mastercard"
23 }
24}
Production OnlyThis call will only work with your Production API Key.
Delete a payment method. The functions in our client libraries accept a priority
parameter (primary
or secondary
), which abstracts the need to pass in payment method IDs or change endpoints used.
The API response for this endpoint is empty. The functions in our client libraries will return true
if the API call succeeds or an error if it fails.
Request Parameters
The payment method to delete from your account. This parameter is only available via one of our client libraries. Possible values:
- primary
- secondary
1curl -X DELETE https://api.easypost.com/v2/credit_cards/card_... \
2 -u "EASYPOST_API_KEY":
1{}