Search Overlay

Cartes

Vous pouvez intégrer votre application de commerce électronique directement à notre API Paiements par carte, agnostique de plateforme, et traiter toutes les principales cartes de crédit par l’intermédiaire de la passerelle de paiement Paysafe.

Cliquez sur les liens ci-dessous pour voir nos exemples de code.

Vérifier l’accessibilité du service

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

Autoriser un paiement par carte

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);

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);

Authorization response = client.cardPaymentService().get(new Authorization(auth.id()));
                                

Pagerator<Authorization> auths = client.cardPaymentService().getAuths(Authorization.Builder()
.merchantRefNum(auth.merchantRefNum())
.Build());

Traiter un achat par carte

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);

AuthorizationReversal authReversal = AuthorizationReversal.Builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.amount(555)
.authorizationId(auth.id())
.Build();

AuthorizationReversal response = client.cardPaymentService().reverseAuth(authReversal);

AuthorizationReversal authReversal = AuthorizationReversal.Builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.amount(222)
.authorizationId(auth.id())
.Build();

AuthorizationReversal response = client.cardPaymentService().reverseAuth(authReversal);

AuthorizationReversal response = client.cardPaymentService().get(new AuthorizationReversal(authReversal.id()));
                                

Pagerator<AuthorizationReversal> authReversals = client.cardPaymentService().getAuthReversals(AuthorizationReversal.Builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.Build());

client.cardPaymentService().approveHeldAuth(new Authorization(auth.id()));
                                

client.cardPaymentService().cancelHeldAuth(new Authorization(auth.id()));
                                

Régler une autorisation de carte

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

Settlement response = client.cardPaymentService().settlement(settle);

Settlement response = client.cardPaymentService().cancelSettlement(settlement);
                                

Settlement response = client.cardPaymentService().get(new Settlement(settlement.id()));
                                

Pagerator<Settlement> settlements = client.cardPaymentService().getSettlements(Settlement.Builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.Build());

Traiter un remboursement par carte

client.cardPaymentService().refund(Refund.Builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.settlementId(settlement.id())
.Build());

Refund response = client.cardPaymentService().get(new Refund(refund.id()));
                                

Pagerator<Refund> refunds = client.cardPaymentService().getRefunds(Refund.Builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.Build());

Vérifier un paiement par carte

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);

Verification response = client.cardPaymentService().get(new Verification(verify.id()));
                                

Pagerator<Verification> refunds = client.cardPaymentService().getVerifications(Verification.Builder()
.merchantRefNum("0f8fad5bd9cb469fa16570867728950e")
.Build());