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

is_online = client.card_payment_service.monitor

Authorize a Card Payment

Process an authorization
auth_obj = Paysafe::CardPayments::Authorization.new ({
  merchantRefNum: "0f8fad5bd9cb469fa16570867728950e",
  amount: 555,
  card: {
    cardNum: 4111111111111111,
    cvv: 123,
    cardExpiry: {
      month: "06",
      year: "2020"
    }
  },
  billingDetails: {
    zip: "M5H 2N2"
  }
})

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

response = client.card_payment_service.authorize auth_obj
Look up an authorization using an authorization ID
auth_obj = Paysafe::CardPayments::Authorization.new ({
  merchantRefNum: "0f8fad5bd9cb469fa16570867728950e"
})

response = client.card_payment_service.get_auths auth_obj
Look up an authorization using a merchant reference number
auth_obj = Paysafe::CardPayments::Authorization.new ({
  merchantRefNum: "0f8fad5bd9cb469fa16570867728950e"
})

response = client.card_payment_service.get_auths auth_obj

Process a Card Purchase

Process a purchase
auth_obj = Paysafe::CardPayments::Authorization.new ({
  merchantRefNum: "0f8fad5bd9cb469fa16570867728950e",
  amount: 555,
  settleWithAuth: true,
  card: {
    cardNum: 4111111111111111,
    cvv: 123,
    cardExpiry: {
      month: "06",
      year: "2020"
    }
  },
  billingDetails: {
    zip: "M5H 2N2"
  }
})

response = client.card_payment_service.authorize auth_obj
Void (reverse) an authorization
auth_reversal = Paysafe::CardPayments::AuthorizationReversal.new ({
  merchantRefNum: "0f8fad5bd9cb469fa16570867728950e",
  amount: 555,
  authorizationID: auth_id
})

response = client.card_payment_service.reverse_auth auth_reversal
Process a partial void (partial reversal)
auth_reversal = Paysafe::CardPayments::AuthorizationReversal.new ({
  merchantRefNum: "0f8fad5bd9cb469fa16570867728950e",
  amount: 222,
  authorizationID: auth_id
})

response = client.card_payment_service.reverse_auth auth_reversal
Look up a void (reversal) using an void ID (authorization reversal ID)
auth_reversal = Paysafe::CardPayments::AuthorizationReversal.new ({
  id: auth_reversal_id
})

response = client.card_payment_service.get_auth_reversal auth_reversal
Look up a void (reversal) using a merchant reference number
auth_reversal = Paysafe::CardPayments::AuthorizationReversal.new ({
  merchantRefNum: "0f8fad5bd9cb469fa16570867728950e"
})

response = client.card_payment_service.get_auth_reversals auth_reversal
Approve a held authorization
auth_obj = Paysafe::CardPayments::Authorization.new ({
  id: auth_id
})

client.card_payment_service.approve_held_auth auth_obj
Cancel a held authorization
auth_obj = Paysafe::CardPayments::Authorization.new ({
  id: auth_id
})

client.card_payment_service.cancel_held_auth auth_obj

Settle a Card Authorization

Settle an authorization
settle_obj = Paysafe::CardPayments::Settlement.new ({
  merchantRefNum: "0f8fad5bd9cb469fa16570867728950e",
  authorizationID: auth_id
})

response = client.card_payment_service.settlement settle_obj
Cancel a settlement
settle_obj = Paysafe::CardPayments::Settlement.new ({
  id: settlement_id
})

response = client.card_payment_service.cancel_settlement settle_obj
Look up a settlement using a settlement ID
settle_obj = Paysafe::CardPayments::Settlement.new ({
  id: settlement_id
})

response = client.card_payment_service.get_settlement settle_obj
Look up a settlement using a merchant reference number
settle_obj = Paysafe::CardPayments::Settlement.new ({
  merchantRefNum: settlement_merchant_ref_num
})

response = client.card_payment_service.get_settlements settle_obj

Process a Card Refund

Process a refund
refund_obj = Paysafe::CardPayments::Refund.new ({
  merchantRefNum: "0f8fad5bd9cb469fa16570867728950e",
  settlementID: settlement_id
})

response = client.card_payment_service.refund refund_obj
Look up a refund using a refund ID
refund_obj = Paysafe::CardPayments::Refund.new ({
  id: refund_id
})

response = client.card_payment_service.get_refund refund_obj
Look up a refund using a merchant reference number
refund_obj = Paysafe::CardPayments::Refund.new ({
  merchantRefNum: refund_merchant_ref_num
})

response = client.card_payment_service.get_refunds refund_obj

Verify a Card Payment

Verify card and billing details
verify_obj = Paysafe::CardPayments::Verification.new ({
  merchantRefNum: "0f8fad5bd9cb469fa16570867728950e",
  card: {
    cardNum: 4111111111111111,
    cvv: 123,
    cardExpiry: {
      month: "06",
      year: "2020"
    }
  },
  profile: {
    firstName: "Joe",
    lastName: "Smith",
    email: "Joe.Smith@canada.com"
  },
  billingDetails: {
    street: "100 Queen Street West",
    city: "Toronto",
    state: "ON",
    country: "CA",
    zip: "M5H2N2"
  },
  customerIp: "204.91.0.12",
  description: "This is a test transaction"
})

response = client.card_payment_service.verify verify_obj
Look up a verification using a verification ID
verify_obj = Paysafe::CardPayments::Verification.new ({
  id: verification_id
})

response = client.card_payment_service.get_verification verify_obj
Look up a verification using a merchant reference number
verify_obj = Paysafe::CardPayments::Verification.new ({
  merchantRefNum: verification_merchant_ref_num
})

response = client.card_payment_service.get_verifications verify_obj
Did you find this page useful?