Billing


Production OnlyThis call will only work with your Production API Key.

Create Credit Card

Important: This endpoint only works for ReferralCustomers or to manage Child Useraccounts. 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

stripe_object_id
i.e. tok_...
Token from Stripe
priority
i.e. primary

Possible values:

  • primary
  • secondary
POST /credit_cards
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  }'
Response
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.

Add Funds to your wallet (One-Time Charge)

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

amount
i.e. 2000
Amount, in USD cents, to be deposited into the user's wallet. Amount must be greater than or equal to the user's current balance.
priority
i.e. "primary"

The payment method from your account: Possible values:

  • primary
  • secondary
POST /bank_accounts/:id/chargesPOST /credit_cards/:id/charges
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  }'
Response
1{}

Production OnlyThis call will only work with your Production API Key.

Retrieve EasyPost's Public Stripe Key

Important: This endpoint only works for ReferralCustomers or to manage Child Useraccounts. 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.

GET /partners/stripe_public_key
1curl -X GET https://api.easypost.com/v2/partners/stripe_public_key \
2  -u "$PARTNER_API_KEY":
Response
1{
2  "public_key": "pk_..."
3}

Production OnlyThis call will only work with your Production API Key.

Retrieve Payment Methods

List payment methods associated with an account.

GET /payment_methods
1curl -X GET https://api.easypost.com/v2/payment_methods \
2  -u "EASYPOST_API_KEY":
Response
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

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

priority
i.e. "primary"

The payment method to delete from your account. This parameter is only available via one of our client libraries. Possible values:

  • primary
  • secondary
DELETE /bank_accounts/:idDELETE /credit_cards/:id
1curl -X DELETE https://api.easypost.com/v2/credit_cards/card_... \
2  -u "EASYPOST_API_KEY":
Response
1{}