Create Payment Intent

To allow the checkout of a shopping cart being managed on your website, it's mandatory to configure an Intent. The Intent contains the necessary information to generate the Lightning Network invoice.

Without setting up an Intent it's impossible to receive a payment in TurinPay

Uri

https://backend.turinlabs.com/graphql

Headers

{
  "apiKey": "turinpay_sk_test_eee78-de9e-4e84-b2e6-fc2ae0687"
}

GraphQL Query

mutation CREATE_PAYMENT_INTENT_MUTATION($input: CreatePaymentIntentInput!) {
  createTPayPaymentIntent(input: $input) {
    __typename
    ... on TPayPaymentIntent {
        id
        userId
        notificationUrl
        orderId
        currency
        price
        description
        executionEnvironment
        createdAt
        expirySeconds
        initDate
        endDate
        active
        multipleInvoicesAllowed
        invoiceExpirationTimeMin
        onlyLN
    }
    ... on Error {
        code
        message
        description
    }
  }
}

Variables (sample)

{
  "input": {
    "notificationUrl": "https://merchant/chargeWebhook",
    "orderId": "2b4749df-3db9-4744-9e09-68eff244a0dd",
    "currency": "EUR",
    "price": 60,
    "description": "description of your product",
    "initDate": "2022-11-04T12:00:00",
    "endDate": "2022-11-04T13:00:00",
    "active": true,
    "multipleInvoicesAllowed": true,
    "invoiceExpirationTimeMin": 60,
    "onlyLN": false
  }
}

Parameters description

  • orderId: (mandatory) identifier of the order associated to this payment intent in your system.

  • description: (mandatory) description associated to the payment intent.

  • currency: (mandatory) currency associated to the payment intent. EUR or USD allowed.

  • price: (mandatory) price associated to the payment intent. Directly related with the currency field.

  • initDate: (mandatory) Init Date of the period of validity of the payment intent.

  • endDate: (mandatory) End Date of the period of validity of the payment intent.

  • multipleInvoicesAllowed: (optional, false as default value) if true, multiple invoices could be created from this payment intent.

  • invoiceExpirationTimeMin: (optional, 30 as default value) Expiration time used in the creation of the invoice from this payment intent.

  • onlyLN: (mandatory) if true, only Lightning invoices will be generated from this payment intent. If false, the invoice creation result will contain info related with BTC, that will allow the invoice onchain payment.

  • notificationUrl: (mandatory) webhook url that will be used when an invoice associated to this payment intent has been paid.

Last updated