0 Tk

Charges

Creating and managing charges

To charge a credit or a debit card, you create a Charge object. You can retrieve and refund individual charges as well as list all charges. Charges are identified by a unique, random ID.

Create a charge

Endpoint: POST /v1/charges

Parameters:

  • amount (required): A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00).
  • currency (required): Three-letter ISO currency code, in lowercase.
  • source (required): A token representing the payment source to be charged, such as a credit card or a bank account.
  • description (optional): An arbitrary string which you can attach to a charge object.

Example request:

curl https://api.stripe.com/v1/charges \
  -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
  -d amount=2000 \
  -d currency=usd \
  -d source=tok_1234567890abcdef \
  -d description="Charge for test@example.com"

Example response:

{
  "id": "ch_1Hh1ZQCm4uUe0pYsmAT9xyLX",
  "object": "charge",
  "amount": 2000,
  "amount_refunded": 0,
  "application": null,
  "application_fee": null, "balance_transaction": "txn_1Hh1ZQCm4uUe0pYsLNgToPPJ",
  "captured": true,
  "created": 1602687576,
  "currency": "usd",
  "customer": null,
  "description": "Charge for test@example.com",
  "destination": null,
  "dispute": null,
  "disputed": false,
  "failure_code": null,
  "failure_message": null,
  "fraud_details": {},
  "invoice": null,
  "livemode": false,
  "metadata": {},
  "on_behalf_of": null,
  "order": null,
  "outcome": null,
  "paid": true,
  "payment_intent": null,
  "payment_method": "card_1Hh1ZQCm4uUe0pYs3LHbUYAk",
  "payment_method_details": {
    "card": {
      "brand": "visa",
      "checks": {
        "address_line1_check": null,
        "address_postal_code_check": null,
        "cvc_check": "pass"
      },
      "country": "US",
      "exp_month": 8,
      "exp_year": 2021,
      "fingerprint": "Xt5EWLLDS7FJjR1c",
      "funding": "credit",
      "installments": null,
      "last4": "4242",
      "network": "visa",
      "three_d_secure": null,
      "wallet": null
    },
    "type": "card"
  },
  "receipt_email": null,
  "receipt_number": null,
  "receipt_url": "https://pay.stripe.com/receipts/...",
  "refunded": false,
  "refunds": {...},
  "review": null,
  "shipping": null,
  "source": {...},
  "source_transfer": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "status": "succeeded",
  "transfer_data": null,
  "transfer_group": null
```}