using Gr4vy;
using Gr4vy.Models.Components;
var sdk = new Gr4vySDK(
id: "mattilda",
server: SDKConfig.Server.Sandbox,
bearerAuthSource: Auth.WithToken(privateKey),
merchantAccountId: "default"
);
var res = await sdk.PaymentMethods.PaymentServiceTokens.CreateAsync(
paymentMethodId: "ef9496d8-53a5-4aad-8ca2-00eb68334389",
paymentServiceTokenCreate: new PaymentServiceTokenCreate() {
PaymentServiceId = "fffd152a-9532-4087-9a4f-de58754210f0",
RedirectUrl = "https://dual-futon.biz",
}
);
// handle response{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_method_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_service_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "processing",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"type": "payment-service-token",
"approval_url": "https://gr4vy.app/redirect/12345",
"token": "pm_12345"
}Create a gateway tokens for a payment method.
using Gr4vy;
using Gr4vy.Models.Components;
var sdk = new Gr4vySDK(
id: "mattilda",
server: SDKConfig.Server.Sandbox,
bearerAuthSource: Auth.WithToken(privateKey),
merchantAccountId: "default"
);
var res = await sdk.PaymentMethods.PaymentServiceTokens.CreateAsync(
paymentMethodId: "ef9496d8-53a5-4aad-8ca2-00eb68334389",
paymentServiceTokenCreate: new PaymentServiceTokenCreate() {
PaymentServiceId = "fffd152a-9532-4087-9a4f-de58754210f0",
RedirectUrl = "https://dual-futon.biz",
}
);
// handle response{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_method_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_service_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "processing",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"type": "payment-service-token",
"approval_url": "https://gr4vy.app/redirect/12345",
"token": "pm_12345"
}payment-methods.write scope.Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The ID of the merchant account to use for this request.
"default"
The ID of the payment method
"ef9496d8-53a5-4aad-8ca2-00eb68334389"
The ID of the payment method to use.
"fffd152a-9532-4087-9a4f-de58754210f0"
The redirect URL to redirect a buyer to after they have authorized the payment method.
"https://example.com/callback"
The 3 or 4 digit security code often found on the card. This often referred to as the CVV or CVD.
3 - 4^\d+$"123"
Successful Response
The ID for the payment service token.
"07e70d14-a0c0-4ff5-bd4a-509959af0e4d"
The ID of the payment method used to generate this token
"ef9496d8-53a5-4aad-8ca2-00eb68334389"
The ID of the payment method used to generate this token.
"fffd152a-9532-4087-9a4f-de58754210f0"
The state of the payment service token.
processing, buyer_approval_required, succeeded, failed, paused "succeeded"
The date and time when this payment service token was first created in our system.
"2013-07-16T19:23:00.000+00:00"
The date and time when this payment service token was last updated in our system.
"2013-07-16T19:23:00.000+00:00"
Always payment-service-token.
"payment-service-token""payment-service-token"
The optional URL that the buyer needs to be redirected to to further authorize the token creation.
"https://gr4vy.app/redirect/12345"
The token value. Will be present if succeeded.
1 - 300"pm_12345"
Was this page helpful?