POST
/
transactions
curl --request POST \
  --url https://api.{gr4vy_id}.gr4vy.app/transactions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "amount": 1299,
  "currency": "USD",
  "payment_method": {
    "expiration_date": "11/25",
    "method": "card",
    "number": "4111111111111111",
    "redirect_url": "https://example.com/callback",
    "security_code": "123"
  }
}'
{
  "amount": 1299,
  "auth_response_code": "00",
  "authorized_amount": 1299,
  "authorized_at": "2013-07-16T19:23:00.000+00:00",
  "avs_response_code": "partial_match_address",
  "buyer": {
    "billing_details": {
      "address": {
        "city": "London",
        "country": "GB",
        "house_number_or_name": "10",
        "line1": "10 Oxford Street",
        "line2": "New Oxford Court",
        "organization": "Gr4vy",
        "postal_code": "789123",
        "state": "Greater London",
        "state_code": "GB-LND"
      },
      "email_address": "john@example.com",
      "first_name": "John",
      "last_name": "Lunn",
      "phone_number": "+1234567890",
      "tax_id": {
        "kind": "gb.vat",
        "value": "12345678931"
      },
      "type": "billing-details"
    },
    "display_name": "John L.",
    "external_identifier": "user-789123",
    "id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
    "type": "buyer"
  },
  "captured_amount": 999,
  "captured_at": "2013-07-16T19:23:00.000+00:00",
  "cart_items": [
    {
      "categories": [
        "<string>"
      ],
      "discount_amount": 123,
      "external_identifier": "item-789123",
      "image_url": "https://example.com/images/items/gopro.png",
      "name": "GoPro HERO9 Camcorder",
      "product_type": "physical",
      "product_url": "https://example.com/items/gopro",
      "quantity": 1,
      "sku": "sku-789123",
      "tax_amount": 123,
      "unit_amount": 37999
    }
  ],
  "checkout_session_id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
  "country": "US",
  "created_at": "2013-07-16T19:23:00.000+00:00",
  "currency": "USD",
  "cvv_response_code": "match",
  "error_code": "missing_redirect_url",
  "external_identifier": "user-789123",
  "gift_card_redemptions": [
    {
      "amount": 1299,
      "error_code": "expired_card",
      "gift_card": {
        "bin": "412345",
        "id": "e6cdf979-87e2-4796-8ff6-9784d5aed893",
        "last4": "1234",
        "sub_bin": "554",
        "type": "gift-card"
      },
      "gift_card_service_redemption_id": "xYqd43gySMtori",
      "id": "bc3f0d5a-3529-4d31-b2b4-848d14926bbc",
      "raw_error_code": "10001",
      "raw_error_message": "Card expired.",
      "refunded_amount": 1299,
      "status": "succeeded",
      "type": "gift-card-redemption"
    }
  ],
  "gift_card_service": {
    "display_name": "Qwikcilver UK",
    "gift_card_service_definition_id": "qwikcilver-gift-card",
    "id": "6c020bf3-179b-4f4f-858d-84e39e196e0f",
    "type": "gift-card-service"
  },
  "id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
  "intent": "authorize",
  "intent_outcome": "pending",
  "is_subsequent_payment": true,
  "merchant_account_id": "default",
  "merchant_initiated": true,
  "metadata": {
    "key": "value"
  },
  "method": "card",
  "multi_tender": true,
  "payment_method": {
    "approval_target": "any",
    "approval_url": "https://api.example.app.gr4vy.com/payment-methods/ffc88ec9-e1ee-45ba-993d-b5902c3b2a8c/approve",
    "country": "US",
    "currency": "USD",
    "details": {
      "bin": "412345",
      "card_type": "credit"
    },
    "expiration_date": "11/25",
    "external_identifier": "user-789123",
    "fingerprint": "20eb353620155d2b5fc864cc46a73ea77cb92c725238650839da1813fa987a17",
    "id": "77a76f7e-d2de-4bbc-ada9-d6a0015e6bd5",
    "label": "1111",
    "last_replaced_at": "2023-07-26T19:23:00.000+00:00",
    "method": "card",
    "payment_account_reference": "V0010014629724763377327521982",
    "scheme": "visa",
    "type": "payment-method"
  },
  "payment_service": {
    "display_name": "Stripe (Main)",
    "id": "stripe-card-faaad066-30b4-4997-a438-242b0752d7e1",
    "method": "card",
    "payment_service_definition_id": "stripe-card",
    "type": "payment-service"
  },
  "payment_service_transaction_id": "charge_xYqd43gySMtori",
  "payment_source": "recurring",
  "pending_review": true,
  "raw_response_code": "incorrect-zip",
  "raw_response_description": "The card's postal code is incorrect. Check the card's postal code or use a\ndifferent card.",
  "reconciliation_id": "7jZXl4gBUNl0CnaLEnfXbt",
  "refunded_amount": 100,
  "scheme_transaction_id": "123456789012345",
  "shipping_details": {
    "address": {
      "city": "London",
      "country": "GB",
      "house_number_or_name": "10",
      "line1": "10 Oxford Street",
      "line2": "New Oxford Court",
      "organization": "Gr4vy",
      "postal_code": "789123",
      "state": "Greater London",
      "state_code": "GB-LND"
    },
    "buyer_id": "8724fd24-5489-4a5d-90fd-0604df7d3b83",
    "email_address": "john@example.com",
    "first_name": "John",
    "id": "8724fd24-5489-4a5d-90fd-0604df7d3b83",
    "last_name": "Lunn",
    "phone_number": "+1234567890",
    "type": "shipping-details"
  },
  "statement_descriptor": {
    "city": "London",
    "description": "Card payment",
    "name": "GR4VY",
    "phone_number": "+1234567890",
    "url": "www.gr4vy.com"
  },
  "status": "processing",
  "three_d_secure": {
    "error_data": {
      "code": "305",
      "component": "C",
      "description": "Invalid ThreeDSCompInd",
      "detail": "The threeDSCompInd must be 'Y' when successful"
    },
    "method": "challenge",
    "response_data": {
      "cavv": "3q2+78r+ur7erb7vyv66vv8=",
      "directory_response": "C",
      "eci": "05",
      "scheme": "visa",
      "version": "<string>",
      "authentication_response": true,
      "cavv_algorithm": "<string>",
      "xid": "<string>"
    },
    "status": "setup_error",
    "version": "2.1.0"
  },
  "type": "transaction",
  "updated_at": "2013-07-16T19:23:00.000+00:00",
  "voided_at": "2013-07-16T19:23:00.000+00:00"
}

This endpoint requires the transactions.write scope.

Authorizations

Authorization
string
headerrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Idempotency-Key
string

A unique key that identifies this request. Providing this header will make this an idempotent request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid collisions.

Body

application/json
amount
integer
required

The monetary amount for this transaction, in the smallest currency unit for the given currency, for example 1299 cents to create an authorization for $12.99.

If the intent is set to capture, an amount greater than zero must be supplied.

All gift card amounts are subtracted from this amount before the remainder is charged to the provided payment_method.

anti_fraud_fingerprint
string | null

This field represents the fingerprint data to be passed to the active anti-fraud service.

async_capture
boolean
default: false

Whether to capture the transaction asynchronously.

  • When async_capture is false (default), the transaction is captured in the same request.
  • When async_capture is true, the transaction is automatically captured at a later time.

Redirect transactions are not affected by this flag.

This flag can only be set to true when intent is set to capture.

browser_info
object

Information about the browser used by the buyer.

buyer_external_identifier
string

The external_identifier of the buyer to associate this payment method to. If this field is provided then the buyer_id field needs to be unset.

If a stored payment method or gift card is provided, then the buyer for that payment method needs to match the buyer for this field.

buyer_id
string

The ID of the buyer to associate this payment method to. If this field is provided then the buyer_external_identifier field needs to be unset.

If a stored payment method or gift card is provided, then the buyer for that payment method needs to match the buyer for this field.

cart_items
object[]

An array of cart items that represents the line items of a transaction.

connection_options
object

Allows for passing optional configuration per connection to take advantage of connection specific features. When provided, the data is only passed to the target connection type to prevent sharing configuration across connections.

Please note that each of the keys this object are in kebab-case, for example cybersource-anti-fraud as they represent the ID of the connector. All the other keys will be snake-case, for example merchant_defined_data.

country
string | null

The 2-letter ISO code of the country of the transaction. This is used to filter the payment services that is used to process the transaction.

If this value is provided for redirect requests and it's not null, it must match the one specified for country in payment_method. Otherwise, the value specified for country in payment_method will be assumed implicitly.

currency
string
required

A supported ISO-4217 currency code.

For redirect requests, this value must match the one specified for currency in payment_method.

external_identifier
string | null

An external identifier that can be used to match the transaction against your own records.

gift_cards
object[] | null

The optional gift card(s) to use for this transaction. At least one gift card is required if no other payment_method has been added. By default, only a maximum limit of 10 gift cards may be used in a single transaction. Please contact our team to change this limit.

  • Transaction gift card request (New)

  • Transaction gift card request (Stored)

intent
enum<string>
default: authorize

Defines the intent of this API call. This determines the desired initial state of the transaction.

  • authorize - (Default) Optionally approves and then authorizes a transaction but does not capture the funds.
  • capture - Optionally approves and then authorizes and captures the funds of the transaction.
Available options:
authorize,
capture
is_subsequent_payment
boolean
default: false

Indicates whether the transaction represents a subsequent payment coming from a setup recurring payment. Please note there are some restrictions on how this flag may be used.

The flag can only be false (or not set) when the transaction meets one of the following criteria:

  • It is not merchant_initiated.
  • payment_source is set to card_on_file.

The flag can only be set to true when the transaction meets one of the following criteria:

  • It is not merchant_initiated.
  • payment_source is set to recurring or installment and merchant_initiated is set to true.
  • payment_source is set to card_on_file.
merchant_initiated
boolean
default: false

Indicates whether the transaction was initiated by the merchant (true) or customer (false).

metadata
object

Any additional information about the transaction that you would like to store as key-value pairs. This data is passed to payment service providers that support it.

payment_method
object

The optional payment method to use for this transaction. This field is required if no gift_cards have been added.

  • Card

  • Redirect

  • Stored payment method request

  • Apple Pay payment method request

  • Google Pay payment method request

  • Checkout Session

payment_source
enum<string>

The source of the transaction. Defaults to ecommerce.

Available options:
ecommerce,
moto,
recurring,
installment,
card_on_file
previous_scheme_transaction_id
string | null

A scheme's transaction identifier to use in connecting a merchant initiated transaction to a previous customer initiated transaction.

If not provided, and a qualifying customer initiated transaction has been previously made, then Gr4vy will populate this value with the identifier returned for that transaction.

e.g. the Visa Transaction Identifier, or Mastercard Trace ID.

shipping_details_id
string | null

The unique identifier of a set of shipping details stored for the buyer.

If provided, the created transaction will include a copy of the details at the point of transaction creation; i.e. it will not be affected by later changes to the detail in the database.

statement_descriptor
object

The statement descriptor is the text to be shown on the buyer's statements.

The specific usage of these fields will depend on the capabilities of the underlying PSP and bank. As a typical example, 'name' and 'description' could be concatenated using '* ' as a separator, and then the resulting descriptor would be truncated to 22 characters by the issuing bank.

store
boolean
default: false

Whether or not to also try and store the payment method with us so that it can be used again for future use. This is only supported for payment methods that support this feature. There are also a few restrictions on how the flag may be set:

  • The flag has to be set to true when the payment_source is set to recurring or installment, and merchant_initiated is set to false.

  • The flag has to be set to false (or not set) when using a previously vaulted payment method.

three_d_secure_data
object

Pass through 3-D Secure data to support external 3-D Secure authorisation. If using an external 3-D Secure provider, you should not pass a redirect_url in the payment_method object for a transaction.

  • 3-D Secure Data Version 1

  • 3-D Secure Data Version 2

Response

201 - application/json
amount
integer

The total amount for this transaction across all funding sources including gift cards.

auth_response_code
string | null

This is the response description received from the processor.

authorized_amount
integer

The amount for this transaction that has been authorized for the payment_method. This can be less than the amount if gift cards were used.

authorized_at
string | null

The date and time when this transaction was authorized in the payment service.

Don't use this field to determine whether the transaction was authorized. A null value doesn't necessarily imply that the transaction wasn't authorized, it can mean that the payment service doesn't provide this value, that it didn't provide it at the time the transaction was authorized or that the transaction was authorized before the introduction of this field.

avs_response_code
enum<string> | null

The response code received from the payment service for the Address Verification Check (AVS). This code is mapped to a standardized Gr4vy AVS response code.

  • no_match - neither address or postal code match
  • match - both address and postal code match
  • partial_match_address - address matches but postal code does not
  • partial_match_postcode - postal code matches but address does not
  • unavailable - AVS is unavailable for card/country

The value of this field can be null if the payment service did not provide a response.

Available options:
no_match,
match,
partial_match_address,
partial_match_postcode,
unavailable
buyer
object

The buyer used for this transaction.

captured_amount
integer

The captured amount for this transaction. This can be the full value of the authorized_amount or less.

captured_at
string | null

The date and time when this transaction was captured in the payment service.

Don't use this field to determine whether the transaction was captured. A null value doesn't necessarily imply that the transaction wasn't captured, it can mean that the payment service doesn't provide this value, that it didn't provide it at the time the transaction was captured or that the transaction was captured before the introduction of this field.

cart_items
object[]

An array of cart items that represents the line items of a transaction.

checkout_session_id
string

The identifier for the checkout session this transaction is associated with.

country
string | null

The 2-letter ISO code of the country of the transaction. This is used to filter the payment services that is used to process the transaction.

created_at
string

The date and time when this transaction was created in our system.

currency
string

The currency code for this transaction.

cvv_response_code
enum<string> | null

The response code received from the payment service for the Card Verification Value (CVV). This code is mapped to a standardized Gr4vy CVV response code.

  • no_match - the CVV does not match the expected value
  • match - the CVV matches the expected value
  • unavailable - CVV check unavailable for card our country
  • not_provided - CVV not provided

The value of this field can be null if the payment service did not provide a response.

Available options:
no_match,
match,
unavailable,
not_provided
error_code
string | null

This is an error code set by Gr4vy.

external_identifier
string | null

An external identifier that can be used to match the transaction against your own records.

gift_card_redemptions
object[]

The gift cards redeemed for this transaction.

gift_card_service
object

The gift card service used for this transaction.

id
string

The unique identifier for this transaction.

intent
enum<string>

The original intent used when the transaction was created.

Available options:
authorize,
capture
intent_outcome
enum<string>

The outcome of the original intent of a transaction.

This allows you to understand if the intent of the transaction (e.g. capture or authorize) has been achieved when dealing with multiple payment instruments.

If all payment instruments (payment_method and/or gift_cards) have succeeded to get an authorization or direct sale at any point in time then this will return a succeeded value.

If any of the payment instruments fails or declines then this will return a failed value.

If any payment instruments is still in a pending or processing state then the result will be pending.

Please note that if any of the payment instruments are voided or refunded after the result reaches a succeeded state then the result will remain unchanged.

Available options:
pending,
succeeded,
failed
is_subsequent_payment
boolean
default: false

Indicates whether the transaction represents a subsequent payment coming from a setup recurring payment. Please note there are some restrictions on how this flag may be used.

The flag can only be false (or not set) when the transaction meets one of the following criteria:

  • It is not merchant_initiated.
  • payment_source is set to card_on_file.

The flag can only be set to true when the transaction meets one of the following criteria:

  • It is not merchant_initiated.
  • payment_source is set to recurring or installment and merchant_initiated is set to true.
  • payment_source is set to card_on_file.
merchant_account_id
string

The ID of the merchant account to which this transaction belongs to.

merchant_initiated
boolean
default: false

Indicates whether the transaction was initiated by the merchant (true) or customer (false).

metadata
object

Additional information about the transaction stored as key-value pairs.

method
enum<string>
Available options:
afterpay,
alipay,
alipayhk,
applepay,
bacs,
bancontact,
banked,
becs,
bitpay,
boleto,
boost,
card,
checkout-session,
click-to-pay,
clearpay,
dana,
dcb,
eps,
fortumo,
gcash,
giropay,
gocardless,
googlepay,
gopay,
grabpay,
ideal,
id,
kakaopay,
klarna,
laybuy,
linepay,
linkaja,
maybankqrpay,
multibanco,
oney_3x,
oney_4x,
oney_6x,
oney_10x,
oney_12x,
ovo,
oxxo,
paymaya,
paypal,
paypalpaylater,
pix,
rabbitlinepay,
razorpay,
scalapay,
sepa,
shopeepay,
singteldash,
sofort,
stripedd,
thaiqr,
touchngo,
truemoney,
trustly,
venmo,
waave,
wechat,
zippay
multi_tender
boolean

Defines if this transaction has been split across multiple payment instruments such as a payment_method and one or more gift_cards, or multiple gift_cards without a payment_method.

payment_method
object

The payment method used for this transaction.

payment_service
object

The payment service used for this transaction.

payment_service_transaction_id
string

The payment service's unique ID for the transaction.

payment_source
enum<string>

The source of the transaction. Defaults to ecommerce.

Available options:
ecommerce,
moto,
recurring,
installment,
card_on_file
pending_review
boolean

Whether a manual review is pending.

raw_response_code
string | null

This is the response code received from the payment service. This can be set to any value and is not standardized across different payment services.

raw_response_description
string | null

This is the response description received from the payment service. This can be set to any value and is not standardized across different payment services.

reconciliation_id
string

The base62 encoded transaction ID. This represents a shorter version of this transaction's id which is sent to payment services, anti-fraud services, and other connectors. You can use this ID to reconcile a payment service's transaction against our system.

This ID is sent instead of the transaction ID because not all services support 36 digit identifiers.

refunded_amount
integer

The refunded amount for this transaction. This can be the full value of the captured_amount or less.

scheme_transaction_id
string | null

An identifier for the transaction used by the scheme itself, when available.

e.g. the Visa Transaction Identifier, or Mastercard Trace ID.

shipping_details
object

The shipping details associated with the transaction.

statement_descriptor
object

The statement descriptor is the text to be shown on the buyer's statements.

The specific usage of these fields will depend on the capabilities of the underlying PSP and bank. As a typical example, 'name' and 'description' could be concatenated using '* ' as a separator, and then the resulting descriptor would be truncated to 22 characters by the issuing bank.

status
enum<string>

The status of the transaction for the payment_method. The status may change over time as asynchronous processing events occur.

Please note that the possible statuses returned will depend on the operation performed. For example, a captured transaction will never move to a authorization_voided status.

Available options:
processing,
buyer_approval_pending,
authorization_succeeded,
authorization_failed,
authorization_declined,
capture_pending,
capture_succeeded,
authorization_void_pending,
authorization_voided
three_d_secure
object

The 3-D Secure data that was sent to the payment service for the transaction.

type
enum<string>

The type of this resource. Is always transaction.

Available options:
transaction
updated_at
string

Defines when the transaction was last updated.

voided_at
string | null

The date and time when this transaction was voided in the payment service.

Don't use this field to determine whether the transaction was voided. A null value doesn't necessarily imply that the transaction wasn't voided, it can mean that the payment service doesn't provide this value, that it didn't provide it at the time the transaction was voided or that the transaction was voided before the introduction of this field.