import { GraphQLClient, gql } from 'graphql-request';
const API_URL = 'https://transactional-graph.staging.fluzapp.com/api/v1/graphql';
const CREATE_VIRTUAL_CARD = gql`
mutation {
createVirtualCard(
input: {
idempotencyKey: "07df5653-43a8-4532-9881-3ab5857bbe12"
spendLimit: 123.45
spendLimitDuration: DAILY
lockDate: "2030-10-10"
lockCardNextUse: true
cardNickname: "Team travel"
primaryFundingSource: FLUZ_BALANCE
offerId: "b3355504-ad30-4b2f-873d-b8795277b918"
}
) {
virtualCardId
cardholderName
expiryMonth
expiryYear
virtualCardLast4
status
initialAmount
createdAt
}
}
`;
const client = new GraphQLClient(API_URL, {
headers: {
Authorization: `Bearer <<USER_ACCESS_TOKEN>>`,
'Content-Type': 'application/json',
},
});
const response = await client.request(CREATE_VIRTUAL_CARD);
console.log(response);
CREATE_VIRTUALCARD.
Relacionado: Tarjetas virtuales.