juspay_expresscheckout v0.1.0 Juspay.Payments

Represents the payment for a particular order through card, netbanking or wallet.

Summary

Functions

Create a payment transaction for Credit or Debit card

Create a payment transaction for NetBanking. Once you have the response, depending on the “method” attribute, you will have to take the next step. If you receive GET, then take the value in the “url” attribute and redirect the user to this location. If you receive POST, then “params” attribute will hold a map containing key value pairs

Refers to either Wallet Payment or Wallet Direct Debit

Functions

create_card_payment(parameters)

Specs

create_card_payment(list | map) :: map

Create a payment transaction for Credit or Debit card.

Note:

For MAESTRO cards that do not have expiry & CVV, send 12/49 as expiry and 111 as CVV.

Examples

# A regular card transaction
   Juspay.Payments.create_card_payment({
                                  :order_id => '1465893617',
                                  :merchant_id => 'guest',
                                  :payment_method_type => 'CARD',
                                  :card_token => '68d6b0c6-6e77-473f-a05c-b460ef983fd8',
                                  :redirect_after_payment => false,
                                  :format => 'json',
                                  :card_number => '5243681100075285',
                                  :name_on_card => 'Customer',
                                  :card_exp_year => '20',
                                  :card_exp_month => '12',
                                  :card_security_code => '123',
                                  :save_to_locker => false
                                 })

# A Stored card transaction
   Juspay.Payments.create_card_payment({
                                 :order_id => '1465893617',
                                 :merchant_id => 'guest',
                                 :payment_method_type => 'CARD',
                                 :card_token => '68d6b0c6-6e77-473f-a05c-b460ef983fd8',
                                 :redirect_after_payment => false,
                                 :format => 'json',
                                 :card_security_code => '123',
                                 :save_to_locker => false
                               })

# response
    %{
      "order_id" => "1465893617",
      "status" => "PENDING_VBV",
      "txn_id" => "guest-1465893617-1",
      "payment" =>
      %{
        "authentication" =>
         %{
          "url" => "https://api.juspay.in/pay/start/guest/8646a7a029974fa99995fec00340a507",
          "method" => "GET",
        }
        ,
      }
      ,
    }
create_net_banking_payment(parameters)

Specs

create_net_banking_payment(list | map) :: map

Create a payment transaction for NetBanking. Once you have the response, depending on the “method” attribute, you will have to take the next step. If you receive GET, then take the value in the “url” attribute and redirect the user to this location. If you receive POST, then “params” attribute will hold a map containing key value pairs.

Examples

     # Example request

      Juspay.Payments.create_net_banking_payment({
                                         :order_id => "1465893617",
                                         :merchant_id => "guest",
                                         :payment_method_type => "NB",
                                         :payment_method => "NB_ICICI",
                                         :redirect_after_payment => false,
                                         :format => "json"
                                        })


     # Example response having POST as method

      %{
       "order_id" => "order_id",
       "status" => "PENDING_VBV",
       "txn_id" => "txn_id",
       "payment" =>
       %{
         "authentication" =>
         %{
           "url" => "https://bank-url.com/payment-path/start",
           "method" => "POST",
           "params" => {
             "key1" => "v1",
             "key2" => "v2",
             "key3" => "v3"
           }
         }
         ,
       }
       ,
      }

     # Example response having GET as method

     %{
       "order_id" => "1465893617",
       "status" => "PENDING_VBV",
       "txn_id" => "guest-1465893617-1",
       "payment" =>  %{
         "authentication" =>  %{
                                "url" => "https://api.juspay.in/pay/start/guest/8646a7a029974fa99995fec00340a507",
                                "method" => "GET",
                                 }
         ,
       }
       ,
    }
create_wallet_payment(parameters)

Specs

create_wallet_payment(list | map) :: map

Refers to either Wallet Payment or Wallet Direct Debit

## WALLET PAYMENT Create a payment transaction for paying from a prepaid Wallet. Once you have the response, depending on the “method” attribute, you will have to take the next step. If you receive GET, then take the value in the “url” attribute and redirect the user to this location. If you receive POST, then “params” attribute will hold a map containing key value pairs.

For Web, you can create a form with these parameters as hidden variables and auto submit the form. Example code in Javascript: “https://gist.github.com/ramanathanrv/31c0b687f0177c37b892”.

For Android, serialize this data such that it can be loaded to WebView directly via postData. Example code in Java: “https://gist.github.com/ramanathanrv/59fb412e1c75a1d9398a”.

##EXAMPLES

   # Example request for Wallet Payment
    Juspay.Payments.create_wallet_payment({
                                    :order_id => "1465893617",
                                    :merchant_id => "guest",
                                    :payment_method_type => "WALLET",
                                    :payment_method => "MOBIKWIK",
                                    :redirect_after_payment => false,
                                    :format => 'json'
                                   })


    # Example response having POST as method

    %{
      "order_id" => "order_id",
      "status" => "PENDING_VBV",
      "txn_id" => "txn_id",
      "payment" =>
      %{
        "authentication" =>
        %{
          "url" => "https://wallet-url.com/payment-path/start",
          "method" => "POST",
          "params" => {
            "key1" => "v1",
            "key2" => "v2",
            "key3" => "v3"
          }
        }
        ,
      }
      ,
    }

    # Example response having GET as method

    %{
      "order_id" => "1465893617",
      "status" => "PENDING_VBV",
      "txn_id" => "shop-1465893617-2",
      "payment" =>
      %{
        "authentication" =>
        %{
          "url" => "https://api.juspay.in/pay/start/shop/8646a7a029974fa99995fec00340a507",
          "method" => "GET",
        }
        ,
      }
      ,
    }

## WALLET DIRECT DEBIT

Directly debit the amount from a Wallet that is linked to a Customer’s account. If the status in the response is CHARGED, then the payment is immediatley successful.

    Note: This is an authenticated call unlike other transaction APIs. This API must be invoked from your server directly.
    DO NOT send the API Key to client

    # Example response having POST as method

    %{
      "order_id" => "order_id",
      "status" => "CHARGED",
      "txn_id" => "txn_id",
      "payment" =>
      %{
        "authentication" =>
        %{
          "url" => "https://api.juspay.in/pay/finish/:merchant-id/:txn-id",
          "method" => "POST",
          "params" => {
            "key1" => "v1",
            "key2" => "v2",
            "key3" => "v3"
          }
        }
        ,
      }
      ,
    }

    # Example response having GET as method

    %{
      "order_id" => "1465893617",
      "status" => "CHARGED",
      "txn_id" => "shop-1465893617-2",
      "payment" =>
      %{
        "authentication" =>
        %{
          "url" => "https://api.juspay.in/pay/finish/:merchant-id/:txn-id",
          "method" => "GET",
        }
        ,
      }
      ,
    }