using Gr4vy;
using Gr4vy.Models.Components;
var sdk = new Gr4vySDK(
id: "example",
server: SDKConfig.Server.Sandbox,
bearerAuthSource: Auth.WithToken(privateKey),
merchantAccountId: "default"
);
var res = await sdk.GiftCards.CreateAsync(giftCardCreate: new GiftCardCreate() {
Number = "4123455541234561234",
Pin = "1234",
});
// handle response{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchant_account_id": "<string>",
"gift_card_service": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"gift_card_service_definition_id": "mock-gift-card",
"display_name": "<string>",
"type": "gift-card-service"
},
"bin": "<string>",
"sub_bin": "<string>",
"last4": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"usage_count": 123,
"cit_usage_count": 123,
"type": "gift-card",
"expiration_date": "2013-07-16T19:23:00.000+00:00",
"buyer": {
"merchant_account_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"type": "buyer",
"id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
"display_name": "John Doe",
"external_identifier": "buyer-12345",
"billing_details": {
"first_name": "John",
"last_name": "Doe",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"address": {
"city": "San Jose",
"country": "US",
"postal_code": "94560",
"state": "California",
"state_code": "US-CA",
"house_number_or_name": "10",
"line1": "Stafford Appartments",
"line2": "29th Street",
"organization": "Gr4vy"
},
"tax_id": {
"value": "<string>",
"kind": "ae.trn"
}
},
"account_number": "<string>"
},
"last_used_at": "2013-07-16T19:23:00.000+00:00",
"cit_last_used_at": "2013-07-16T19:23:00.000+00:00"
}Store a new gift card in the vault.
using Gr4vy;
using Gr4vy.Models.Components;
var sdk = new Gr4vySDK(
id: "example",
server: SDKConfig.Server.Sandbox,
bearerAuthSource: Auth.WithToken(privateKey),
merchantAccountId: "default"
);
var res = await sdk.GiftCards.CreateAsync(giftCardCreate: new GiftCardCreate() {
Number = "4123455541234561234",
Pin = "1234",
});
// handle response{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchant_account_id": "<string>",
"gift_card_service": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"gift_card_service_definition_id": "mock-gift-card",
"display_name": "<string>",
"type": "gift-card-service"
},
"bin": "<string>",
"sub_bin": "<string>",
"last4": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"usage_count": 123,
"cit_usage_count": 123,
"type": "gift-card",
"expiration_date": "2013-07-16T19:23:00.000+00:00",
"buyer": {
"merchant_account_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"type": "buyer",
"id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
"display_name": "John Doe",
"external_identifier": "buyer-12345",
"billing_details": {
"first_name": "John",
"last_name": "Doe",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"address": {
"city": "San Jose",
"country": "US",
"postal_code": "94560",
"state": "California",
"state_code": "US-CA",
"house_number_or_name": "10",
"line1": "Stafford Appartments",
"line2": "29th Street",
"organization": "Gr4vy"
},
"tax_id": {
"value": "<string>",
"kind": "ae.trn"
}
},
"account_number": "<string>"
},
"last_used_at": "2013-07-16T19:23:00.000+00:00",
"cit_last_used_at": "2013-07-16T19:23:00.000+00:00"
}gift-cards.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 16-19 digit number for the gift card.
16 - 19^\d+$"4123455541234561234"
The PIN for this gift card.
1"1234"
The ID of the buyer to associate this gift card to. If this field is provided then the buyer_external_identifier field needs to be unset.
"fe26475d-ec3e-4884-9553-f7356683f7f9"
The external_identifier of the buyer to associate this gift card to. If this field is provided then the buyer_id field needs to be unset.
1 - 200"buyer-12345"
Successful Response
The ID for the gift card.
"356d56e5-fe16-42ae-97ee-8d55d846ae2e"
The ID of the merchant account this buyer belongs to.
"default"
The service this gift card belongs to.
Show child attributes
The first 6 digits of the full gift card number.
"412345"
The 3 digits after the bin of the full gift card number.
"554"
The last 4 digits for the gift card.
"1234"
The date this gift card record was created at.
"2013-07-16T19:23:00.000+00:00"
The date this gift card record was last updated at.
"2013-07-16T19:23:00.000+00:00"
The number of times this gift card has been used in transactions.
100
The number of times this gift card has been used in transactions for client initiated transactions.
50
Always gift-card.
"gift-card""gift-card"
The date and time when this gift card expires. This is a full date/time and may be more accurate than the actual expiry date received by the gift card service.
"2013-07-16T19:23:00.000+00:00"
The buyer for which this gift card is stored.
Show child attributes
The timestamp when this gift card was last used in a transaction.
"2013-07-16T19:23:00.000+00:00"
The timestamp when this gift card was last used in a transaction for client initiated transactions.
"2013-07-16T19:23:00.000+00:00"