Skip to content

Instantly share code, notes, and snippets.

@alamgircsebd
Created October 18, 2022 19:04
Show Gist options
  • Save alamgircsebd/120e1e1903ba6947ee51771fa96b38bb to your computer and use it in GitHub Desktop.
Save alamgircsebd/120e1e1903ba6947ee51771fa96b38bb to your computer and use it in GitHub Desktop.
<script>
( function( $ ) {
fetch('https://backend.turinlabs.com/graphql', {
method: 'POST',
headers: {
'apiKey': 'turinpay_sk_test_c6c713d9-d4e6-4b7e-893a-005b5b2a5bd2',
},
body: JSON.stringify({
query: `
mutation CREATE_PAYMENT_INTENT_MUTATION($input: CreatePaymentIntentInput!) {
createTPayPaymentIntent(input: $input) {
__typename
... on TPayPaymentIntent {
id
}
... on Error {
code
message
description
}
}
}
`,
variables: {
"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
}
},
}),
})
.then((res) => res.json())
.then((result) => console.log(result));
}( jQuery ) );
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment