Card Payments API

You can integrate your e-commerce application directly to our platform-agnostic Card Payments API and process all major credit cards through the Paysafe payment gateway.

Click the links below to view our code samples.

Verify That the Service Is Accessible

bool isOnline = client.cardPaymentService().monitor();

Authorize a Card Payment

Process an authorization
Authorization auth = Authorization.Builder()
    .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
    .amount(555)
    .card()
        .cardNum("4111111111111111")
        .cvv("123")
        .cardExpiry()
            .month(06)
            .year(2020)
            .Done()
        .Done()
    .billingDetails()
        .zip("M5H 2N2")
        .Done()
    .Build();

Authorization response = client.cardPaymentService().authorize(auth);
Process a complex authorization
Authorization auth = Authorization.Builder()
    .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
    .amount(6666)
    .settleWithAuth(false)
    .card()
        .cardNum("4111111111111111")
        .cvv("123")
        .cardExpiry()
            .month(06)
            .year(2020)
            .Done()
        .Done()
    .authentication()
        .eci(5)
        .cavv("AAABCIEjYgAAAAAAlCNiENiWiV+=")
        .xid("OU9rcTRCY1VJTFlDWTFESXFtTHU=")
        .threeDEnrollment("Y")
        .threeDResult("Y")
        .signatureStatus("Y")
        .Done()
     .billingDetails()
        .street("100 Queen Street West")
        .city("Toronto")
        .state("ON")
        .country("CA")
        .zip("M5H 2N2")
        .Done()
     .shippingDetails()
        .carrier("UPS")
        .shipMethod("N")
        .street("100 Queen Street West")
        .city("Toronto")
        .state("ON")
        .country("CA")
        .zip("M5H 2N2")
        .Done()
     .customerIp("204.91.0.12")
     .description("Got U a video")
    .Build();

Authorization response = client.cardPaymentService().authorize(auth);
Look up an authorization using an authorization ID
Authorization response = client.cardPaymentService().get(new Authorization(auth.id()));
Look up an authorization using a merchant reference number
Pagerator<Authorization> auths = client.cardPaymentService().getAuths(Authorization.Builder()
       .merchantRefNum(auth.merchantRefNum())
       .Build());

Process a Card Purchase

Process a purchase
Authorization auth = Authorization.Builder()
    .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
    .amount(555)
    .settleWithAuth(true)
    .card()
        .cardNum("4111111111111111")
        .cvv("123")
        .cardExpiry()
            .month(06)
            .year(2020)
            .Done()
        .Done()
    .billingDetails()
        .zip("M5H 2N2")
        .Done()
    .Build();

Authorization response = client.cardPaymentService().authorize(auth);
Void (reverse) an authorization
AuthorizationReversal authReversal = AuthorizationReversal.Builder()
    .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
    .amount(555)
    .authorizationId(auth.id())
    .Build();

AuthorizationReversal response = client.cardPaymentService().reverseAuth(authReversal);
Process a partial void (partial reversal)
AuthorizationReversal authReversal = AuthorizationReversal.Builder()
    .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
    .amount(222)
    .authorizationId(auth.id())
    .Build();

AuthorizationReversal response = client.cardPaymentService().reverseAuth(authReversal);
Look up a void (reversal) using an void ID (authorization reversal ID)
AuthorizationReversal response = client.cardPaymentService().get(new AuthorizationReversal(authReversal.id()));
Look up a void (reversal) using a merchant reference number
Pagerator<AuthorizationReversal> authReversals = client.cardPaymentService().getAuthReversals(AuthorizationReversal.Builder()
   .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
   .Build());
Approve a held authorization
client.cardPaymentService().approveHeldAuth(new Authorization(auth.id()));
Cancel a held authorization
client.cardPaymentService().cancelHeldAuth(new Authorization(auth.id()));

Settle a Card Authorization

Settle an authorization
Settlement settle = Settlement.Builder()
    .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
    .authorizationId(auth.id())
    .Build();

Settlement response = client.cardPaymentService().settlement(settle);
Cancel a settlement
Settlement response = client.cardPaymentService().cancelSettlement(settlement);
Look up a settlement using a settlement ID
Settlement response = client.cardPaymentService().get(new Settlement(settlement.id()));
Look up a settlement using a merchant reference number
Pagerator<Settlement> settlements = client.cardPaymentService().getSettlements(Settlement.Builder()
    .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
    .Build());

Process a Card Refund

Process a refund
client.cardPaymentService().refund(Refund.Builder()
    .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
    .settlementId(settlement.id())
    .Build());
Look up a refund using a refund ID
Refund response = client.cardPaymentService().get(new Refund(refund.id()));
Look up a refund using a merchant reference number
Pagerator<Refund> refunds = client.cardPaymentService().getRefunds(Refund.Builder()
    .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
    .Build());

Verify a Card Payment

Verify card and billing details
Verification ver = Verification.Builder()
    .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
    .card()
        .cardNum("4111111111111111")
        .cardExpiry()
            .month(DateTime.Now.Month)
            .year(DateTime.Now.Year)
            .Done()
        .cvv("123")
        .Done()
     .profile()
        .firstName("Joe")
        .lastName("Smith")
        .email("Joe.Smith@canada.com")
        .Done()
     .billingDetails()
        .street("100 Queen Street West")
        .city("Toronto")
        .state("ON")
        .country("CA")
        .zip("M5H2N2")
        .Done()
     .customerIp("204.91.0.12")
     .description("This is a test transaction")
     .Build();

Verification response = client.cardPaymentService().verify(ver);
Look up a verification using a verification ID
Verification response = client.cardPaymentService().get(new Verification(verify.id()));
Look up a verification using a merchant reference number
Pagerator<Verification> refunds = client.cardPaymentService().getVerifications(Verification.Builder()
    .merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
    .Build());
Did you find this page useful?