Skip to content

Create a test SharedPaymentGrantedToken ​

Creates a new test SharedPaymentGrantedToken object. This endpoint is only available in test mode and allows sellers to create SharedPaymentGrantedTokens for testing their integration

Returns ​

Returns the newly created SharedPaymentGrantedToken

Parameters ​

  • payment_method (string, required) The PaymentMethod that is going to be shared by the SharedPaymentGrantedToken.

  • usage_limits (object, required) Limits on how this SharedPaymentGrantedToken can be used.

    • usage_limits.currency (enum, required) Three-letter ISO currency code, in lowercase. Must be a supported currency.

    • usage_limits.max_amount (integer, required) Max amount that can be captured using this SharedPaymentToken

    • usage_limits.expires_at (timestamp, optional) Time at which this SharedPaymentToken expires and can no longer be used to confirm a PaymentIntent.

  • customer (string, optional) The Customer that the SharedPaymentGrantedToken belongs to. Should match the Customer that the PaymentMethod is attached to if any.

  • shared_metadata (object, optional) Set of key-value pairs that you can attach to the SharedPaymentGrantedToken.

curl
curl https://api.stripe.com/v1/test_helpers/shared_payment/granted_tokens \
  -u "<<YOUR_SECRET_KEY>>" \
  -d payment_method={{PAYMENT_METHOD_ID}} \
  -d "usage_limits[currency]=usd" \
  -d "usage_limits[expires_at]=1751587220" \
  -d "usage_limits[max_amount]=1000"

Response ​

json
{
  "id": "spt_1RgaZcFPC5QUO6ZCDVZuVA8q",
  "object": "shared_payment.granted_token",
  "agent_details": {
    "network_business_profile": "profile_test_61U92KWAstyE3VYhXA6U91t01FSQ3ByrZzKJOCR0y5ey"
  },
  "created": 1751500820,
  "deactivated_at": null,
  "deactivated_reason": null,
  "livemode": false,
  "payment_method_details": {
    "type": "card",
    "billing_details": {
      "address": {
        "city": null,
        "country": null,
        "line1": null,
        "line2": null,
        "postal_code": null,
        "state": null
      },
      "email": null,
      "name": "John Doe",
      "phone": null
    },
    "card": {
      "brand": "visa",
      "country": "US",
      "display_brand": "visa",
      "exp_month": 9,
      "exp_year": 2029,
      "fingerprint": "dyRcYjZNxnHpC51l",
      "funding": "credit",
      "last4": "4242",
      "networks": {
        "available": [
          "visa"
        ],
        "preferred": null
      },
      "wallet": null
    }
  },
  "shared_metadata": {},
  "usage_details": {
    "amount_captured": {
      "value": 0,
      "currency": "usd"
    }
  },
  "usage_limits": {
    "currency": "usd",
    "expires_at": 1751587220,
    "max_amount": 1000
  }
}

Stripe API Reference - Self-contained docs reference, refreshed 2026-05-18