Skip to content

Get Payment Gateway Fee of Credit Card

POST https://api.staging.sawfish.com.au/graphql

Get a fee calculation based on the payment amount and the credit card details provided.

Header Type Required
x-jwt-token string

Requires a valid token (expires every 10 minutes - refresh required).

query paymentCreditCardFeeCalc($amount: Float!, $credit_card: CreditCardInput!, $contact: ContactInput!) {
paymentCreditCardFeeCalc(amount: $amount, credit_card: $credit_card, contact: $contact) {
amount
fees
total_settlement_amount
card_account_uid
card_type
}
}
Terminal window
curl --request POST \
--url https://api.staging.sawfish.com.au/graphql \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'x-jwt-token: your-jwt-token' \
--data '
{
"query": "query paymentCreditCardFeeCalc($amount: Float!, $credit_card: CreditCardInput!, $contact: ContactInput!) { paymentCreditCardFeeCalc(amount: $amount, credit_card: $credit_card, contact: $contact) { amount fees total_settlement_amount card_account_uid card_type } }",
"variables": {
"amount": 100,
"credit_card": {
"full_name": "John Doe",
"card_number": "4444333322221111",
"expiry_month": "01",
"expiry_year": "30",
"cvv": "123"
},
"contact": {
"first_name": "John",
"last_name": "Doe",
"email": "j.doe@example.com",
"country": "Australia"
}
}
}
'

Expiry month and year are each 2 digits ("01", "30"). The returned card_account_uid can be passed back in credit_card.card_account_uid on Process Payment instead of the raw card details.

{
"data": {
"paymentCreditCardFeeCalc": {
"amount": 100,
"fees": 1.75,
"total_settlement_amount": 101.75,
"card_account_uid": "card-account-uid",
"card_type": "visa"
}
}
}

See Interfaces for the full CreditCardInput and ContactInput definitions.