Skip to main content
The charge operation captures funds from a card immediately. Use this for standard purchases where you’re ready to fulfill the order.
Some payment processors require additional parameters. See the Additional Guidance section for processor-specific requirements.

Basic Charge

const response = await fetch('https://api.orchestrasolutions.com/PaymentGateway/charge', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Api-Key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    amount: 25.00,
    currency: 'USD',
    paymentGatewayAccountName: 'stripe-production',
    card: {
      cardNumber: '4111111111111111',
      cardHolderName: 'Jane Smith',
      expirationMonth: 12,
      expirationYear: 2027,
      cvv: '123'
    }
  })
});

const result = await response.json();

Request Parameters

ParameterTypeRequiredDescription
amountnumberYesAmount in major units (e.g., 25.00 for $25.00)
currencystringYesISO 4217 currency code (e.g., “USD”, “EUR”)
cardobjectYesCard details (see below)
paymentGatewayAccountNamestringConditionalName of stored Payment Gateway Account. Required if not providing paymentGatewayAccount inline.
paymentGatewayAccountobjectConditionalInline gateway credentials. Takes precedence over paymentGatewayAccountName.
myRefstringNoYour custom reference for this transaction
payerDetailsobjectNoBilling information of the card owner
isDigitalbooleanNoRequired by some processors for digital goods
orderDescstringNoOrder description (required by some processors)
certificateNamestringNoClient certificate name if required by gateway
networkTokenBrandstringNoFor network tokens: “Visa”, “MasterCard”, or “Amex”

Card Object

FieldTypeRequiredDescription
cardNumberstringYesCard number (PAN), or a token reference with @ prefix (e.g., @abc123)
cardHolderNamestringYesCardholder name as it appears on the card
expirationMonthintegerYesTwo-digit expiration month (1-12)
expirationYearintegerYesFour-digit expiration year
cvvstringNoCard verification code
To use a tokenized card number, prefix the token with @ in the cardNumber field: "cardNumber": "@your-token-id". See Tokenization.

Payer Details Object

FieldTypeDescription
firstNamestringCardholder first name
lastNamestringCardholder last name
emailstringEmail address
addressstringStreet address
citystringCity
statestringState/province
zipstringPostal code
countryCodestringCountry code
clientIPAddressstringCustomer’s IP address

Using a Stored Token

If you’ve tokenized a card number with StringTokens, reference it in the cardNumber field with an @ prefix:
const response = await fetch('https://api.orchestrasolutions.com/PaymentGateway/charge', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Api-Key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    amount: 25.00,
    currency: 'USD',
    paymentGatewayAccountName: 'stripe-production',
    card: {
      cardNumber: '@nQGywsQE9gbURtrXEjTZwtWqeMdK9nsO',  // Token with @ prefix
      cardHolderName: 'Jane Smith',
      expirationMonth: 12,
      expirationYear: 2027,
      cvv: '123'
    }
  })
});

Using Inline Credentials

Instead of a stored Payment Gateway Account, you can provide credentials inline:
const response = await fetch('https://api.orchestrasolutions.com/PaymentGateway/charge', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Api-Key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    amount: 25.00,
    currency: 'USD',
    paymentGatewayAccount: {
      paymentGatewayName: 'Stripe',
      credentials: [
        { Key: 'SecretKey', Value: 'sk_live_...' }
      ]
    },
    card: {
      cardNumber: '4111111111111111',
      cardHolderName: 'Jane Smith',
      expirationMonth: 12,
      expirationYear: 2027,
      cvv: '123'
    }
  })
});

Response Codes

CodeDescription
202Accepted - transaction sent to payment gateway
400Bad request - invalid parameters
401Not authenticated - invalid API key
409Conflict - rejected by payment gateway
500Error with payment gateway
503Temporary failure with payment gateway

Charge vs Authorize

OperationWhen to Use
ChargeImmediate fulfillment, digital goods, services
AuthorizeDelayed fulfillment, physical goods, variable amounts
If you need to hold funds without capturing immediately, use Authorize & Capture instead.