Queries and Mutations

Bellow is a list of all queries and mutations you can use with our API

In the examples there are // comments serving as an additional information to specific part of the code. Remove them before sending a query. Otherwise, it will throw an error.

Also you can use custom currency code (except if you are using dev environment because some gateways allows only specific code during the testing).

Gateway Action (mutation)

Trigger action via gateway:

mutation gatewayAction($input: GatewayActionMutationInput!) {
  gatewayAction(input: $input) {
    result {
      status
      description
      data
    }
  }
}

with variables:

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "braintree",
    "action": "clientToken",
    "parameters": {}
  }
}

Adyen

Get payment details

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "adyen",
    "action": "paymentDetails",
    "parameters": {
      "details": {
        "MD": "", //given from Pay mutation
        "PaRes": "" //given from Pay mutation
      },
      "paymentData": "" //optional
    }
  }
}

Get payment methods

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "adyen",
    "action": "paymentMethods",
    "parameters": {
      "countryCode": "CZ", //optional
      "channel": "", //optional
      "amount": { //optional
        "currency": "EUR",
        "value": "1000"
      }
    }
  }
}

Payment result

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "adyen",
    "action": "paymentResult",
    "parameters": {
      "payload": "" //given from Pay mutation
    }
  }
}

Braintree

Create client token

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "braintree",
    "action": "clientToken",
    "parameters": {
      "customerId": "123" //optional ID from gateway
    }
  }
}

PayU

List available payment methods

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "pay_u",
    "action": "payMethods",
    "parameters": {
      "lang": "en" //optional
    }
  }
}

Cancel payment

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "pay_u",
    "action": "cancel",
    "parameters": {
      "orderId": "xxx" //returned id from gateway after Pay mutation
    }
  }
}

Retrieve payment

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "pay_u",
    "action": "retrieve",
    "parameters": {
      "orderId": "xxx" //returned id from gateway after Pay mutation
    }
  }
}

Retrieve transaction payments

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "pay_u",
    "action": "retrieveTransaction",
    "parameters": {
      "orderId": "xxx" //returned id from gateway after Pay mutation
    }
  }
}

Update order status

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "pay_u",
    "action": "statusUpdate",
    "parameters": {
      "orderId": "xxx", //returned id from gateway after Pay mutation
      "orderStatus": "COMPLETED" //or REJECTED
    }
  }
}

Stripe

Change retrieve

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "stripe",
    "action": "chargeRetrieve",
    "parameters": {
      "id": "" //ID given from gateway
    }
  }
}

Pay (mutation)

Pay via gateway:

mutation pay($input: PayMutationInput!) {
  pay(input: $input) {
    result {
      status
      description
      data
    }
  }
}

with variables:

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "braintree",
    "payment": "nonce",
    "orderId": "AB012345",
    "parameters": {
      "amount": 10,
      "nonce": "fake-valid-nonce"
    }
  }
}

Adyen

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "adyen",
    "payment": "payments",
    "orderId": "1977200894",
    "parameters": {
      "paymentMethod": "", //data from JS gateway plugin
      "returnUrl": "https://www.example.com/successful-payment",
      "amount": {
        "currency": "EUR",
        "value": 10000
      }
    }
  }
}

Braintree

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "braintree",
    "payment": "nonce",
    "orderId": "1977200894",
    "parameters": {
      "amount": "10000",
      "nonce": "", //nonce from JS gateway plugin
      "customer": { //optional
        "firstName": "John",
        //...
      },
      "billing": { //optional
        "firstName": "John",
        //...
      },
      "shipping": { //optional
        "firstName": "John",
        //...
      }
    }
  }
}

PayU

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "pay_u",
    "payment": "order",
    "orderId": "1977200894",
    "parameters": {
      "continueUrl": "https://www.example.com/successful-payment",
      "currencyCode": "PLN",
      "totalAmount": "10000",
      "products": [
        {
          "name": "Red t-shirt",
          "unitPrice": "10000",
          "quantity": 1
        }
      ],
      "buyer": { //optional
        "email": "john.doe@example.com",
        "phone": "123123123",
        "firstName": "John",
        "lastName": "Doe",
        "language": "en"
      },
      "delivery": { //optional
        "recipientName": "John Doe",
        "recipientEmail": "john.doe@example.com",
        "recipientPhone": "123123123",
        "street": "Rybná 123",
        "postalBox": "",
        "postalCode": "11100",
        "city": "Prague",
        "state": "Czech Republic",
        "countryCode": "CZ"
      },
      "payMethod": { //optional
        "type": "PBL", //or "CARD_TOKEN", "INSTALLMENTS"
        "value": "c" //see GatewayAction "payMethods"
      }
    }
  }
}

Stripe

{
  "input": {
    "token": "Q84lNQyLl?nBGvKxxbcdc!nWFKEZrK?L_Is2r9IaOJo14ONbXw1SMlPIeptcaFza",
    "environment": "sandbox",
    "gateway": "stripe",
    "payment": "charge",
    "orderId": "1977200894",
    "parameters": {
      "amount": "10000",
      "currency": "EUR",
      "source": "" //source from JS gateway plugin
    }
  }
}

 

Create E-commerce in 5 minutes

Try it. It is for free.