Skip to main content
Charge a customer’s saved PayPal account without requiring the customer to approve each payment. Common scenarios include:
  • Subscription renewals
  • On-demand services billed after usage
  • Automatic bill payments
  • One-click purchases for returning customers
Use PayPal’s vault parameter to save the customer’s PayPal information. The customer approves once. Then you can charge their PayPal account without them present.

Prerequisites

Integrate server side

# Step 1: Create order with vault=true
curl -X POST https://api-m.paypal.com/v2/checkout/orders \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -d '{
    "intent": "CAPTURE",
    "payment_source": {
      "paypal": {
        "experience_context": {
          "return_url": "https://example.com/return",
          "cancel_url": "https://example.com/cancel"
        },
        "attributes": {
          "vault": {
            "store_in_vault": "ON_SUCCESS",
            "usage_type": "MERCHANT",
            "customer_type": "CONSUMER"
          }
        }
      }
    },
    "purchase_units": [{
      "amount": {
        "currency_code": "USD",
        "value": "10.00"
      }
    }]
  }'

# Step 2: After customer approval, capture the order
curl -X POST https://api-m.paypal.com/v2/checkout/orders/{order_id}/capture \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ACCESS_TOKEN"

# Extract payment token from response:
# capture.payment_source.paypal.attributes.vault.id

# Step 3: Later, charge using saved token
curl -X POST https://api-m.paypal.com/v2/checkout/orders \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -d '{
    "intent": "CAPTURE",
    "payment_source": {
      "token": {
        "id": "PAYMENT_TOKEN_ID",
        "type": "PAYMENT_METHOD_TOKEN"
      }
    },
    "purchase_units": [{
      "amount": {
        "currency_code": "USD",
        "value": "29.99"
      }
    }]
  }'