Embedded

Create a payment request and return a payment_token for iframe flow

Create a payment request and return a payment_token for iframe flow

post/api/v1/embedded/payment-requests

Request body

merchant_idstring uuid

Merchant ID. Defaults to the logged-in merchant if not provided. Required for admin tokens.

device_type'web' | 'ios' | 'android'

Platform/device type for the payment request

webhook_endpointsstring[]

Optional. Up to 10 registered webhook endpoints to fan this payment's webhooks out to, each signed with its own secret. An endpoint can be test-only, live-only, or both. Omit to use the no-reference precedence: the legacy default URL, then the merchant's default endpoint, then the single active endpoint.

Example request

{
  "merchant_id": "550e8400-e29b-41d4-a716-446655440000",
  "customer": {
    "name": "John Doe",
    "email": "john@example.com",
    "phone": "+351960123456",
    "country": "GB"
  },
  "order": {
    "order_id": "ORD-123456",
    "amount": 9300,
    "currency": "GBP",
    "payment_reference": "Barcelona Tryp",
    "locale": "en-GB",
    "test_transaction": true,
    "rewards": {
      "extra_rewards": 150,
      "total_rewards": 300,
      "description": "Loyalty bonus + base rewards"
    }
  },
  "device_type": "ios",
  "billing_address": {
    "address_line1": "12 West Common Drive",
    "address_line2": "Flat 1",
    "apartment": "Apt 5B",
    "city": "London",
    "state_province": "Greater London",
    "country": "GB",
    "postal_code": "SE1 1AA",
    "company_name": "Acme Ltd"
  },
  "redirect_urls": {
    "success_url": "https://tryp.com/checkout/success",
    "failure_url": "https://tryp.com/checkout/error"
  },
  "webhook_endpoints": [
    "wizzair-prod"
  ]
}

Response

Created

successboolean required

Indicates if the request was successful

Example response

{
  "success": true,
  "data": {
    "payment_token": "ptok_efghijklm...",
    "expires_in": 900
  }
}

Changes

Changed in 4 of the 8 revisions of this API.417

    • added the new optional request property webhook_endpoints

      new-optional-request-property

  • b372e7d5563d315See the full diff
    • added the pattern ^[A-Za-z]{2}$ to the request property customer/country

      request-property-pattern-added

    • added the pattern ^[A-Za-z]{3}$ to the request property order/currency

      request-property-pattern-added

    • the error/code response's property type/format changed from string/ to / for status 400

      response-property-type-changed

    • removed the optional property error/errors from the response with the 400 status

      response-optional-property-removed

    • added the new optional request property billing_address

      new-optional-request-property

    • added the new optional request property merchant_id

      new-optional-request-property

    • added the new optional request property simulation

      new-optional-request-property

    • added the optional property error/metadata to the response with the 400 status

      response-optional-property-added

    • added subschema #1 subschema #2 to the error/code response property allOf list for the response status 400

      response-property-all-of-added

    This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • endpoint added

      endpoint-added

    This revision also has 5 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • api path removed without deprecation

      api-path-removed-without-deprecation

    This revision also has 367 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog