Skip to main content
Version: Live

Making a Payment with Payment Method Tokens

This guide will walk you through how to make a one time payment by using the payment method token.

Create one time payment​

Sensitive information like credit card numbers or bank account numbers are replaced by the payment method token.

GraphQL
mutation {
createTransaction(amount: Int,
merchant_uid: String,
payment_method_id: String,
account_code: String,
currency: String,
fee: Int,
fee_mode: FeeMode,
invoice_id: String,
metadata: JSON) {
amount
card_brand
created_at
currency
last_four
service_fee
status
transaction_id
}
}

Required Arguments​

Keytypedescription
amountintThe amount of the transaction. If the FeeMode is SERVICE_FEE, this is the amount of the transaction before fees.
merchant_uidstringThe Pay Theory unique identifier for the merchant the transaction is for.
payment_method_idstringThe Pay Theory unique identifier for the payment method the transaction will be charged to.
feeintIf your fee mode is SERVICE_FEE, you must also pass in the fee and fee_mode arguments. The amount of the fee that will be charged to the payor for the transaction if the FeeMode is SERVICE_FEE.
fee_modeFeeModeThe fee mode on the transaction. SERVICE_FEE charges the fees to the payor. MERCHANT_FEE charges the fees to the merchant. Options are
  • SERVICE_FEE
  • MERCHANT_FEE(default)

Optional Arguments​

Keytypedescription
account_codestringCustomer defined account code for the transaction.
currencystringThe type of currency for the transaction. Defaults to USD.
invoice_idstringThe Pay Theory unique identifier for the invoice the transaction is for.
metadataJSONCustom defined JSON object to be stored with the transaction.

Returns​

The createTransaction mutation will return a transaction object

Keytypedescription
statusTransactionStatusThe status of the transaction. Options are:
  • PENDING
  • SUCCEEDED
  • FAILED
amountintThe amount of the transaction. This is the amount after fees if the FeeMode is SERVICE_FEE.
card_brandstringThe brand of the card used for the transaction.
last_fourstringThe last four digits of the card or bank account used for the transaction.
service_feeintThe amount of the service fee charged for the transaction. This will be 0 if the FeeMode is MERCHANT_FEE.
currencystringThe type of currency for the transaction.
transaction_idstringThe Pay Theory unique identifier for the transaction.
created_atDateTimeThe date and time the transaction was created.

Next Steps​

You can also refer to Recurring payment here Recurring Payments.