ResourcesInvoices

Create a checkout session

This endpoint creates a checkout session for a pending invoice.

This endpoint creates a checkout session for a pending invoice.

A practical example:

  1. You first create an invoice via the the create an invoice endpoint
  2. Then generate a checkout session via this endpoint.
  3. Finally, you retrieve the payment_url you receive in the response, and show this to your customer as a button, or redirect them to the respective URL.

Note

If the invoice is priced as zero, which means it's a free product, the invoice will instead be marked as completed.

See the code examples for how to create a new invoice payment URL with the SellApp API.

POST
/v2/invoices/{invoice}/checkout

Authorization

bearerAuth
AuthorizationBearer <token>

Provide your SellApp API key as a bearer token.

In: header

Path Parameters

invoice*integer

The invoice path parameter.

Response Body

application/json

application/json

curl -X POST "https://sell.app/api/v2/invoices/0/checkout"
{
  "message": "A new payment session has been generated.",
  "payment_url": "https://commerce.coinbase.com/charges/CQEGF35V",
  "invoice": {
    "id": 1,
    "payment": {
      "fee": {
        "base": "0",
        "currency": "USD",
        "units": 1,
        "vat": 0,
        "total": {
          "exclusive": "0",
          "inclusive": "0"
        }
      },
      "gateway": {
        "data": {
          "total": {
            "base": "1999",
            "currency": "USD",
            "units": 1,
            "vat": 0,
            "total": {
              "exclusive": "1999",
              "inclusive": "1999"
            }
          },
          "customer_email": "customer@example.com",
          "transaction_id": "CQEGF35V",
          "checkout_url": "https://commerce.coinbase.com/charges/CQEGF35V"
        },
        "type": "COINBASE"
      },
      "subtotal": {
        "base": "1999",
        "currency": "USD",
        "units": 1,
        "vat": 0,
        "total": {
          "exclusive": "1999",
          "inclusive": "1999"
        }
      },
      "expires_at": "2024-01-09T23:50:11.000000Z",
      "full_price": {
        "base": "1999",
        "currency": "USD",
        "units": 1,
        "vat": 0,
        "total": {
          "exclusive": "1999",
          "inclusive": "1999"
        }
      },
      "original_amount": {
        "base": "1999",
        "currency": "USD",
        "units": 1,
        "vat": 0,
        "total": {
          "exclusive": "1999",
          "inclusive": "1999"
        }
      }
    },
    "status": {
      "history": [],
      "status": {
        "setAt": "2024-01-09T14:50:11.000000Z",
        "status": "PENDING",
        "updatedAt": "2024-01-09T18:00:50.000000Z"
      }
    },
    "webhooks": [],
    "feedback": "",
    "created_at": "2024-01-09T14:50:11.000000Z",
    "updated_at": "2024-01-09T18:00:50.000000Z",
    "store_id": 1,
    "coupon_id": null,
    "subscription_id": null,
    "customer_information": {
      "id": 123,
      "email": "customer@example.com",
      "country": "Germany",
      "location": "Munich",
      "ip": "1.3.3.7",
      "proxied": false,
      "browser_agent": "Mozilla/4.9 (Windows 98; sl-SI; rv:1.9.1.20) Gecko/20110422 Firefox/21.0",
      "vat": {
        "amount": 0,
        "country": "DE"
      }
    }
  }
}
{
  "message": "A new payment session has been generated.",
  "payment_url": "https://commerce.coinbase.com/charges/CQEGF35V",
  "invoice": {
    "id": 1,
    "payment": {
      "fee": {
        "base": "0",
        "currency": "USD",
        "units": 1,
        "vat": 0,
        "total": {
          "exclusive": "0",
          "inclusive": "0"
        }
      },
      "gateway": {
        "data": {
          "total": {
            "base": "1999",
            "currency": "USD",
            "units": 1,
            "vat": 0,
            "total": {
              "exclusive": "1999",
              "inclusive": "1999"
            }
          },
          "customer_email": "customer@example.com",
          "transaction_id": "CQEGF35V",
          "checkout_url": "https://commerce.coinbase.com/charges/CQEGF35V"
        },
        "type": "COINBASE"
      },
      "subtotal": {
        "base": "1999",
        "currency": "USD",
        "units": 1,
        "vat": 0,
        "total": {
          "exclusive": "1999",
          "inclusive": "1999"
        }
      },
      "expires_at": "2024-01-09T23:50:11.000000Z",
      "full_price": {
        "base": "1999",
        "currency": "USD",
        "units": 1,
        "vat": 0,
        "total": {
          "exclusive": "1999",
          "inclusive": "1999"
        }
      },
      "original_amount": {
        "base": "1999",
        "currency": "USD",
        "units": 1,
        "vat": 0,
        "total": {
          "exclusive": "1999",
          "inclusive": "1999"
        }
      }
    },
    "status": {
      "history": [],
      "status": {
        "setAt": "2024-01-09T14:50:11.000000Z",
        "status": "PENDING",
        "updatedAt": "2024-01-09T18:00:50.000000Z"
      }
    },
    "webhooks": [],
    "feedback": "",
    "created_at": "2024-01-09T14:50:11.000000Z",
    "updated_at": "2024-01-09T18:00:50.000000Z",
    "store_id": 1,
    "coupon_id": null,
    "subscription_id": null,
    "customer_information": {
      "id": 123,
      "email": "customer@example.com",
      "country": "Germany",
      "location": "Munich",
      "ip": "1.3.3.7",
      "proxied": false,
      "browser_agent": "Mozilla/4.9 (Windows 98; sl-SI; rv:1.9.1.20) Gecko/20110422 Firefox/21.0",
      "vat": {
        "amount": 0,
        "country": "DE"
      }
    }
  }
}