juspay_expresscheckout v0.1.0 Juspay.Customers

Represents a customer who is using your service.

Summary

Functions

Create a new customer entity. You may invoke this method whenever someone registers in your website or App. JusPay will respond with an ID that you can persist in your Database. Pass this ID at the time of order creation to ensure proper linking of orders/payments belonging to a customer

This will return customer information for given identifier

Update information related to a particulat customer

Functions

create(parameters)

Specs

create(list | map) :: map

Create a new customer entity. You may invoke this method whenever someone registers in your website or App. JusPay will respond with an ID that you can persist in your Database. Pass this ID at the time of order creation to ensure proper linking of orders/payments belonging to a customer.

Examples

 # input in the form of map (works with both string keyed map and atom keyed map)

 iex> Juspay.Customers.create(%{ :object_reference_id => "guest_user",
                            :mobile_number => "9988776655",
                            :email_address => "customer@mail.com",
                            :first_name => "John",
                            :last_name => "Smith",
                            :mobile_country_code => "91"
                          })

 # input in the form of list

 iex> Juspay.Customers.create([ object_reference_id: "guest_user",
                          mobile_number:"9988776655",
                          email_address: "customer@mail.com",
                          first_name: "John",
                          last_name: "Smith",
                          mobile_country_code: "91"
                        ])

# response

%{
  "id" => "cst_om2l6ctlptxwxuzj",
  "object" => "customer",
  "object_reference_id" => "guest_user",
  "mobile_number" => "9988776655",
  "date_created" => "2016-08-02T08:07:52+0000",
  "last_updated" => "2016-08-02T08:07:52+0000",
  "email_address" => "customer@gmail.com",
  "first_name" => "John",
  "last_name" => "Smith",
  "mobile_country_code" => "91"
}
get(parameters)

Specs

get(list | map) :: map

This will return customer information for given identifier.

Examples

 # input in the form of map (works with both string keyed map and atom keyed map)

 iex> Juspay.Customers.get(%{ :customer_id => "guest_user" }) or Customers.create([customer_id: "guest_user" ])

 # input in the form of list

 iex> Juspay.Customers.get([ customer_id: "guest_user" ])

# response

%{
  "id" => "cst_om2l6ctlptxwxuzj",
  "object" => "customer",
  "object_reference_id" => "guest_user",
  "mobile_number" => "9988776655",
  "date_created" => "2016-08-02T08:07:52+0000",
  "last_updated" => "2016-08-02T08:07:52+0000",
  "email_address" => "customer@gmail.com",
  "first_name" => "John",
  "last_name" => "Smith",
  "mobile_country_code" => "91"
}
update(parameters)

Specs

update(list | map) :: map

Update information related to a particulat customer.

Examples

 # input in the form of map (works with both string keyed map and atom keyed map)

 iex> Juspay.Customers.update(%{
                          :customer_id => "guest_user",
                          :mobile_number => "9988776688",
                          :customer_email => "customer@mail.com",
                          :first_name => "udpate_firstname",
                          :last_name =>"udpate_lastname",
                          :mobile_country_code => "91"
                        })

 # input in the form of list

 iex> Juspay.Customers.update([
                        customer_id: "guest_user",
                        mobile_number: "9988776688",
                        customer_email: "customer@mail.com",
                        first_name: "udpate_firstname",
                        last_name: "udpate_lastname",
                        mobile_country_code: "91"
                        ])

# response

%{
  "id" => "cst_om2l6ctlptxwxuzj",
  "object" => "customer",
  "object_reference_id" => "guest_user",
  "mobile_number" => "9988776688",
  "date_created" => "2016-08-02T08:07:52+0000",
  "last_updated" => "2016-08-02T08:07:58+0000",
  "email_address" => "customer@gmail.com",
  "first_name" => "John",
  "last_name" => "Smith",
  "mobile_country_code" => "91"
}