Skip to content
Terra WalletDevelopers

Early access. The Terra API and SDKs may change before launch, and the SDK packages are not published yet.

View as Markdown

API reference

Early access

Payment intents

One payment for one amount. Terra quotes an exact crypto amount per accepted asset, the customer pays from their own wallet to yours, and the intent succeeds only on verified chain data.

Authentication: Secret key or dashboard session.

Guide: Payment intents

MethodPathSummary
POST/v1/payment_intentsCreate a payment intent and its hosted checkout URL.

POST/v1/payment_intents#

Create a payment intent and its hosted checkout URL.

  • Operation id: createPaymentIntent
  • Authentication: Secret key or dashboard session
  • Idempotency-Key: required
  • Source: the v1 contract. This operation is not in the OpenAPI document yet.

Request body#

NameTypeRequiredNotes
amountstring (decimal)yesA decimal string such as "10.50", never a float.
currencystringyesA fiat ISO code: USD, EUR, INR and so on.
accepted_assetsarray of assetyesAssets the customer may pay with. An asset is {chain, symbol, contract (null for a native coin), decimals}.
descriptionstringnoPlain text.
metadataobjectnoUp to 20 keys; string values up to 500 characters.
expires_in_sintegerno300 to 86400. Default 900.
success_urlstring (url)no
cancel_urlstring (url)no
customer_emailstring (email)no

Response#

The payment intent. status is one of requires_payment, processing, succeeded, expired, canceled, underpaid, overpaid.

JSON

{  "id": "pi_...",  "status": "requires_payment",  "checkout_url": "https://pay.terrawallet.us/c/pi_...",  "amount": "10.50",  "currency": "USD",  "quotes": [    {      "asset": {        "chain": "tron",        "symbol": "USDT",        "contract": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",        "decimals": 6      },      "amount_base_units": "...",      "pay_address": "...",      "expires_at": "..."    }  ]}

Notes#

  • Verification: an exact unique amount per intent, a confirmation policy per chain, one transaction per intent, chain truth only.
  • Amounts on chain are integer base units in strings, with the asset's decimals alongside.