Naviga Subscribe API
Naviga
  • Subscribe API
  • Payments API
    • Migration to Payments API
      • Apply Payment
      • EZPay Sign Up
      • Update EZPay Info
      • Restart
      • Create Payment Method
      • Get Payment Method by Id
      • Add Tip
  • Users Orchestrator API
    • Migration to UsersOrchestrator API
      • Get By Id
      • Get By Email
      • Get By Query String
      • Get By Encrypted Email
      • Get By Encrypted Id
      • Get By Token
      • Create User
      • Create Passwordless User
      • Update User
      • Update Password
      • Update Email
      • Authenticate/Authenticate By Token
      • ForgotPassword
      • Verify Email
      • Send Verification Code
  • Entitlements Orchestrator API
    • Migration to EntitlementsOrchestrator API
      • Access
Powered by GitBook
LogoLogo

COPYRIGHT © 2024 NAVIGA

On this page
  • Introduction
  • Comparison
  • Create Payment Method
Export as PDF
  1. Payments API
  2. Migration to Payments API

Create Payment Method

Introduction

This endpoint is used to create a new payment method for a Subscriber using either a Credit Card or a Bank Account and to create a new record in the PaymentMethod table in the database.

Comparison

Compared to the older model, the new input model requires just a few parameters, as explained in detail below.

Note: For the time being, both the old and new endpoints are in the Billing API.

Billing API (OLD)
Billing API (NEW)

URL

/Billing/{subscriptionId}/PaymentMethods

/Billing/PaymentMethods

Method

POST

POST

Input Example

Credit Card example:

BankAccount example:


Create Payment Method

POST /Billing/PaymentMethods

This endpoint is used to create a new payment method for a Subscriber using either a Credit Card or a Bank Account and to create a new record in the PaymentMethod table in the database.

Note: The parameters marked with an asterisk (*) are mandatory and must be included in the input model.

Headers

Name
Type
Description

Authorization*

String

JSON Web Token used for security purposes

X-SourceSystem*

String

To identify the consumer or the Source System

X-MediaGroupCode*

String

Media Group Code of the Tenant

X-ClientCode*

String

Client Code of the Tenant

X-PaperCode*

String

Paper Code of the Tenant

Request Body

Name
Type
Description

SubscriptionId*

Integer

Unique identifier of the Subscription in Naviga System

BillingAddressId

Integer

Unique identifier of the current Subscriber Billing address in Naviga System.

BillingSystemPaymentMethodId

String

Unique identifier of the payment method in Naviga System.

(Used by the data team.)

HolderName*

String

For a Bank Account payment method, it’s the Subscriber’s name, and for a Credit Card payment method, it’s the Credit Card name.

CreditCard.CreditCardType

Integer

Represents the credit card type. Possible values: American Express (1), Visa (2), MasterCard (3), Diners (4), Discover (5).

CreditCard.CreditCardNumber

String

Masked Credit Card number.

Required if Payment Method is Credit Card.

CreditCard.CreditCardExpirationYear

Integer

Credit card expiration year.

Required if Payment Method is Credit Card.

CreditCard.CreditCardExpirationMonth

Integer

Credit card expiration month.

Required if Payment Method is Credit Card.

BankAccount.BankAccountNumber

String

Bank account number.

Required if Payment Method is Bank Account.

BankAccount.BankName

String

Name of the bank.

Required if Payment Method is Bank Account.

BankAccount.BankAccountType

Integer

Represents the bank account type.

Required if Payment Method is Bank Account.

Possible values: CheckingsAccount(1), SavingsAccount (2), CorporateCheckingsAccount(3).

PaymentMethodType

Integer

Represents the payment method type.

Possible values: CreditCard(1), BankAccount(2), MerchantAcceptedPayment(3), Coupon(4), PayPal(5), PayPalExpress(6), iTunes(7), GooglePlay(8), ApplePay(9), AmazonInApp(10), SubscribeWithGoogle(11), GooglePay(12), ExternalPayment(13), Piano(14)

PaymentGatewayCustomerId

String

Unique identifier of the Payment Method’s owner in the Payment Gateway Systems.

Required if Payment Method is Credit Card.

Note: This parameter is not managed by all payment gateways; however, Stripe, Braintree, and NavigaPay do.

PaymentGatewayToken

String

Unique identifier of the Payment Method in the Payment Gateway Systems (Payway, AuthorizeNET, Stripe, Braintree, NavigaPay, etc).

Required (and mandatory) if Payment Method is Credit Card.

PaymentMethod.CreditCard.CardOwner

String

Credit card Owner name.

Required if Payment Method is Credit Card.

BankAccount.BankRoutingNumber

String

Bank account routing number.

Required if Payment Method is Bank Account.

{
  "Code": 200,
  "Errors": [],
  "Result": {
    "PaymentMethodId": 789507
  },
  "SessionId": null,
  "RequestId": null
}
{
   "Code":400,
   "Errors":[
      {
         "Message":"Invalid inputs.",
         "Code":"BILLING_01",
         "Type":{
            "Id":0,
            "Code":"Validation"
         },
         "ErrorSource":null
      }
   ],
   "Result":null,
   "SessionId":"string",
   "RequestId":"string"
}
{
   "Code":400,
   "Errors":[
      {
         "Message":"Subscription not found.",
         "Code":"Billing_01",
         "Type":{
            "Id":0,
            "Code":"Validation"
         },
         "ErrorSource":null
      }
   ],
   "Result":null,
   "SessionId":"string",
   "RequestId":"string"
}
{
   "Code":400,
   "Errors":[
      {
         "Message":"Billing Address not found.",
         "Code":"Billing_03",
         "Type":{
            "Id":0,
            "Code":"Validation"
         },
         "ErrorSource":null
      }
   ],
   "Result":null,
   "SessionId":"string",
   "RequestId":"string"
}
{
   "Code":500,
   "Errors":[
      {
         "Message":"Error getting newspaper configuration settings.",
         "Code":"Billing_02",
         "Type":{
            "Id":0,
            "Code":"Validation"
         },
         "ErrorSource":null
      }
   ],
   "Result":null,
   "SessionId":"string",
   "RequestId":"string"
}
{
   "Code":500,
   "Errors":[
      {
         "Message":"Failed to create ADDPAYMENTMETHOD Event.",
         "Code":"Billing_04",
         "Type":{
            "Id":1,
            "Code":"NotProcessingAllowed"
         },
         "ErrorSource":null
      }
   ],
   "Result":null,
   "SessionId":"string",
   "RequestId":"string"
}
{
   "Code":500,
   "Errors":[
      {
         "Message":"Failed to update ADDPAYMENTMETHOD Event.",
         "Code":"Billing_05",
         "Type":{
            "Id":1,
            "Code":"NotProcessingAllowed"
         },
         "ErrorSource":null
      }
   ],
   "Result":null,
   "SessionId":"string",
   "RequestId":"string"
}
{
   "Code":400,
   "Errors":[
      {
         "Message":"Failed when saving Payment Method to DB.",
         "Code":"Billing_06",
         "Type":{
            "Id":0,
            "Code":"Validation"
         },
         "ErrorSource":null
      }
   ],
   "Result":null,
   "SessionId":"string",
   "RequestId":"string"
}
{
    "error": "Authorization is missing."
}
{
    "error": "X-SourceSystem is missing."
}
{
    "error": "Invalid Source System."
}
{
    "error": "Invalid authorization."
}
{
    "error": "Something went wrong. Please try again later."
}
PreviousRestartNextGet Payment Method by Id

Last updated 9 months ago

{
   "PaymentMethod":{
      "PaymentMethodId":0,
      "ExternalPaymentMethodId":"10203992",
      "PaymentMethodType":1,
      "PaymentMethodTypeName":"CreditCard",
      "PlatformSpecificTypeName":null,
      "AccountHolder":"EARL HROZA",
      "CreditCard":{
         "CardType":2,
         "CreditCardType":2,
         "CreditCardNumber":"XXXXXXXXXXXX1111",
         "ExpirationYear":2028,
         "ExpirationMonth":2,
         "CardSecurityCode":"",
         "CardOwner":"john smith",
         "LastFourDigits":"1111"
      },
      "BankAccount":null,
      "PayPalInfo":null,
      "OfflinePayment":null,
      "BillingAddress":{
         "AddressId":1700202,
         "BillingSystemAddressId":null,
         "PrimaryAddress":null,
         "AlternateAddresses":null,
         "CountryName":null,
         "CityName":null,
         "DistrictName":null,
         "ProvinceOrTerritory":null,
         "PhoneNumber":null,
         "ZipCode":null,
         "AddressName":null
      },
      "PaymentSource":null,
      "TermsAndConditionsAccepted":true,
      "ExternalToken":"10203992",
      "ExternalCustomerId":null,
      "IsDefault":false
   },
   "BillingAddressId":1700202,
   "ValidateAddress":null,
   "AccountInfo":{
      "SubscriptionId":245316,
      "SubscriberId":4784,
      "RegistrationId":0
   }
}
{
  "HolderName": "Clark Kent",
  "CreditCard": {
    "CreditCardExpirationMonth": "06",
    "CreditCardExpirationYear": "12",
    "CreditCardNumber": "4111********1111",
    "CreditCardType": 1
  },
  "BillingAddressId": 1859629,
  "BillingSystemPaymentMethodId": "test",
  "PaymentGatewayToken": "ASFWE234234",
  "PaymentGatewayCustomerId": "HKUSDYISD"
  "SubscriptionId": 20,
  "PaymentMethodType": 1
}
{
  "HolderName": "Bruce Wayne",
  "BankAccount": {
    "BankAccountNumber": "123456",
    "BankAccountType": 1,
    "BankName": "Gotham City Bank",
    "BankRoutingNumber": "3456324"
  },
  "BillingAddressId": 0,
  "SubscriptionId": 20,
  "PaymentMethodType": 2
}