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
| Key | type | description |
|---|---|---|
| amount | int | The amount of the transaction. If the FeeMode is SERVICE_FEE, this is the amount of the transaction before fees. |
| merchant_uid | string | The Pay Theory unique identifier for the merchant the transaction is for. |
| payment_method_id | string | The Pay Theory unique identifier for the payment method the transaction will be charged to. |
| fee | int | If 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_mode | FeeMode | The fee mode on the transaction. SERVICE_FEE charges the fees to the payor. MERCHANT_FEE charges the fees to the merchant. Options are
|
Optional Arguments
| Key | type | description |
|---|---|---|
| account_code | string | Customer defined account code for the transaction. |
| currency | string | The type of currency for the transaction. Defaults to USD. |
| invoice_id | string | The Pay Theory unique identifier for the invoice the transaction is for. |
| metadata | JSON | Custom defined JSON object to be stored with the transaction. |
Returns
The createTransaction mutation will return a transaction object
| Key | type | description |
|---|---|---|
| status | TransactionStatus | The status of the transaction. Options are:
|
| amount | int | The amount of the transaction. This is the amount after fees if the FeeMode is SERVICE_FEE. |
| card_brand | string | The brand of the card used for the transaction. |
| last_four | string | The last four digits of the card or bank account used for the transaction. |
| service_fee | int | The amount of the service fee charged for the transaction. This will be 0 if the FeeMode is MERCHANT_FEE. |
| currency | string | The type of currency for the transaction. |
| transaction_id | string | The Pay Theory unique identifier for the transaction. |
| created_at | DateTime | The date and time the transaction was created. |
Next Steps
You can also refer to Recurring payment here Recurring Payments.