Create Virtual Card
createVirtualCard
Use the createVirtualCard
mutation to create your virtual card. This mutation requires an CreateVirtualCardInput input object and CREATE_VIRTUALCARD scope.
Sandbox Valid Virtual Card Test Offers:
Offer ID | Program Name | Reward Value |
---|---|---|
ed669305-5e43-40a0-9a25-7a15ed174628 | Virtual Card | 1.5% |
b23630f6-8d91-43df-84aa-a541e7691197 | Virtual Card - Mastercard Prepaid | 1.5% |
592c394e-26cc-44ac-a145-a5f81301fe77 | Brand Locked Virtual Card - Mastercard Prepaid | 1.5% |
Important Considerations for Virtual Card Creation
- Funding Source: You can fund your virtual cards using either your Fluz balance or a linked bank account.
- If you select a bank account as the
primaryFundingSource
, you must provide thebankAccountId
.
- If you select a bank account as the
- Spend Limits: The
spendLimit
you set must adhere to the program's defined spend limits for the chosenspendLimitDuration
. An error will occur if the limit is exceeded.
Arguments
input
(CreateVirtualCardInput!
): The input object containing details for the new virtual card.
CreateVirtualCardInput Fields
Field | Type | Description | Required |
---|---|---|---|
idempotencyKey | UUID! | A unique client-generated UUID to ensure a request is processed only once. | Yes |
spendLimit | Float! | The maximum amount you can charge to the card. You are only charged for the amount actually used. | Yes |
spendLimitDuration | VirtualCardSpendLimitDuration | Card limit duration type. Default is LIFETIME . | No |
lockDate | String | The date when the card will be locked. The default is 47 months from creation. Format: yyyy-mm-dd | No |
lockCardNextUse | Boolean | Setting to lock the card after its next use. The default is false . | No |
cardNickname | String | The card's nickname. | No |
primaryFundingSource | VirtualCardFundingSource | Primary Funding Source for Virtual Card. Default is FLUZ_BALANCE . | No |
bankAccountId | UUID | The unique identifier for the bank account. Required if primaryFundingSource is BANK_ACCOUNT . | No |
offerId | UUID | The Offer Id of Virtual Card Offer. Use getVirtualCardOffers to fetch a list of active offers. | No |
cURL Example
curl -X POST \
https://transactional-graph.staging.fluzapp.com/api/v1/graphql \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_USER_ACCESS_TOKEN' \
-d '{
"query": "mutation CreateVirtualCard { createVirtualCard( input: { spendLimit: 150.00, idempotencyKey: \"63b2c9e0-62d1-42ab-b1c2-1a7ee2f8c0a9\", offerId: \"b3355504-ad30-4b2f-873d-b8795277b918\", spendLimitDuration: MONTHLY, lockCardNextUse: false, cardNickname: \"My New Test Card\", primaryFundingSource: FLUZ_BALANCE } ) { virtualCardId userId cardholderName expiryMonth expiryYear virtualCardLast4 status cardType initialAmount usedAmount createdAt } }"
}'
Sample Mutation
mutation {
createVirtualCard(
input: {
idempotencyKey: "07df5653-43a8-4532-9881-3ab5857bbe12"
spendLimit: 123.45
spendLimitDuration: DAILY
lockDate: "2030-10-10"
lockCardNextUse: true
cardNickname: "xyz789"
primaryFundingSource: FLUZ_BALANCE
offerId: "b3355504-ad30-4b2f-873d-b8795277b918"
}
) {
virtualCardId
userId
cardholderName
expiryMonth
expiryYear
virtualCardLast4
status
cardType
initialAmount
usedAmount
createdAt
}
}
Sample Response
{
"data": {
"createVirtualCard": {
"virtualCardId": "07df5653-43a8-4532-9881-3ab5857bbe11",
"userId": "07df5653-43a8-4532-9881-3ab5857bbe11",
"cardholderName": "xyz789",
"expiryMonth": "12",
"expiryYear": "27",
"virtualCardLast4": "7890",
"status": "ACTIVE",
"cardType": "MULTI_USE",
"initialAmount": 150.00,
"usedAmount": 0,
"createdAt": "2025-07-09T10:00:00Z"
}
}
}
Response Field Explanations
virtualCardId
(UUID
): The unique identifier assigned to the newly created virtual card.userId
(UUID
): The unique identifier of the user who created this virtual card.cardholderName
(String
): The name of the cardholder as it appears on the virtual card.expiryMonth
(String
): The two-digit expiration month of the virtual card (e.g., "12" for December).expiryYear
(String
): The two-digit expiration year of the virtual card (e.g., "27" for 2027).virtualCardLast4
(String
): The last four digits of the virtual card number.status
(VirtualCardStatus
): The current status of the virtual card (e.g., ACTIVE, PENDING).cardType
(VirtualCardType
): Indicates if the card is MULTI_USE or SINGLE_USE.initialAmount
(Float
): The original spendLimit set when the card was created.usedAmount
(Float
): The total amount that has been spent using this virtual card so far.
Code Example:
Create Virtual Card
Open Recipe
Want to learn more? Contact us at [email protected]
Speak with our experts for more info or to request a demo.
Updated 11 days ago