跳到正文

Acme API v2024-06 is live — see the changelog for what changed.

Dashboard

API snippets

Reference API examples and schemas from any page.

本页尚未翻译,当前显示原文。

Request snippet

POST/payments
curl -X POST https://api.acme.dev/v1/payments \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
         "amount": 2500,
         "currency": "usd",
         "customer": "cus_8f3k2",
         "description": "Pro plan — June"
       }'
POST/refunds
curl -X POST https://api.acme.dev/v1/refunds \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
         "payment": "string"
       }'

Response snippet

{
  "id": "pay_3Jk2Lm",
  "object": "payment",
  "amount": 2500,
  "currency": "usd",
  "status": "requires_payment_method",
  "customer": {
    "id": "cus_8f3k2",
    "email": "user@example.com",
    "name": "Ada Lovelace",
    "address": {
      "line1": "string",
      "city": "string",
      "country": "US"
    }
  },
  "created_at": "2024-01-15T09:30:00Z",
  "refunds": [
    {
      "id": "string",
      "amount": 1
    }
  ]
}

Endpoint schema

请求

该接口需要一个对象。
amountinteger必填

Amount in the smallest currency unit.

currencystring必填

Three-letter ISO currency code.

customerstring可选

ID of an existing customer.

descriptionstring可选<=500 characters
metadatamap from strings to strings可选

Up to 50 key/value pairs.

payment_methodobject可选
typeenum必填
可选值:
tokenstring必填

Token from Acme.js.

Webhook payload

HOOKpaymentSucceeded
{
  "id": "evt_1",
  "type": "payment.succeeded",
  "data": {
    "id": "pay_3Jk2Lm",
    "object": "payment",
    "amount": 2500,
    "currency": "usd",
    "status": "requires_payment_method",
    "customer": {
      "id": "cus_8f3k2",
      "email": "user@example.com",
      "name": "Ada Lovelace",
      "address": {
        "line1": "string",
        "city": "string",
        "country": "US"
      }
    },
    "created_at": "2024-01-15T09:30:00Z",
    "refunds": [
      {
        "id": "string",
        "amount": 1
      }
    ]
  }
}

Types

The Customer object
{
  "id": "cus_8f3k2",
  "email": "user@example.com",
  "name": "Ada Lovelace",
  "address": {
    "line1": "string",
    "city": "string",
    "country": "US"
  }
}
idstring可选
emailemail可选
namestring可选
addressobject可选
line1string可选
citystring可选
countrystring可选

Runnable endpoint

GEThttps://api.acme.dev/v1/payments/:payment_id