Class: PaysecureApiDocumentationLive::MVirtualCardsPayoutApi
- Defined in:
- lib/paysecure_api_documentation_live/apis/m_virtual_cards_payout_api.rb
Overview
MVirtualCardsPayoutApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#create_customer(brand_id, body) ⇒ ApiResponse
OVERIEW The createCustomer API allows merchants to create a customer profile on PaySecure when a user visits their website, facilitating a seamless payment experience by pre-filling the customer's details, on the PaySecure Cashier.
-
#create_pay_out(body) ⇒ ApiResponse
To Initiate a payout, the very first call to make is /payout/ with the required data in the request body.
-
#get_customer(brand_id, accept) ⇒ ApiResponse
This endpoint makes an HTTP GET request to retrieve customer information from the Paysecure API.
Methods inherited from BaseApi
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from PaysecureApiDocumentationLive::BaseApi
Instance Method Details
#create_customer(brand_id, body) ⇒ ApiResponse
OVERIEW The createCustomer API allows merchants to create a customer profile on PaySecure when a user visits their website, facilitating a seamless payment experience by pre-filling the customer's details, on the PaySecure Cashier. The API takes in customer information and returns a unique customerID that can be passed in purchase payload, eliminating the need for customers to manually enter their details during transactions.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| merchantCustomerId | String | Yes | unique customer ID provided by | |
| merchant. This can be email, mobile or an alphanumeric string |
[rahultestcustomer@paysecure.net](https://mailto:rahultestcustomer@paysecu re.net) | | fullName | String | Yes | Full name of the customer. | Rahul Agarwal | | emailId | String | Yes | Email address of the customer. | test@paysecure.net | | dateOfBirth | String | Optional | Customer's date of birth in YYYY-MM-DD format. | 1995-12-27 | | phoneNo | String | Yes | Customer's phone number. Preferred with the country code | +91 797639082 | | city | String | Optional | City of the customer. | Jaipur | | stateCode | String | Yes | State code of the customer. | RJ | | zipCode | String | Optional | Postal code of the customer's location. | 302018 | | address | String | Optional | Full address of the customer. | House Number 53, Vaishali Nagar, Jaipur | | country | String | Yes | Country code (ISO 3166-1 alpha-2). | IN | | custRegDate | Sting | Optional | Customer registration date on merchant site in YYYY-MM-DD format. | 2023-12-27 | | successTxn | String | Optional | Number of successful transactions customer has carried on merchant site. | 32 |
User Flow
-
Customer visits merchant's website: The customer selects the product or service and proceeds to checkout page.
-
Merchant calls the
createCustomerAPI: The merchant sends aPOSTrequest to the Paysecure API with the customer's details. -
Customer ID generation: Paysecure processes the request and generates a unique
customerIdwhich is returned in the response. -
Payment Process: The merchant uses the
customerIdfor subsequent session creation, ensuring the customer doesn’t need to re-enter their details for future payments.
Benefits
-
Seamless user experience: The customer does not have to enter their details manually for every purchase.
-
Faster Checkout: The merchant can use the
customerIdfor faster payment processing. -
Data Security: Customer details are stored securely and can be reused across transactions, reducing the chances of errors.
Implementing createCustomer on merchant site:
The createCustomer can be implemented on merchant site in one of two
ways, depending on merchant’s integration flow:
At Checkout:
When a customer initiates the checkout process, your system should invoke
the createCustomer API, before actually starting the session.
-
Call
createCustomer: This API call generates a unique customer ID. -
Use of Customer ID: Pass the returned customer ID in Session API, when creating a payment session.
Upon Customer Login:
Alternatively, merchants may choose to call createCustomer at the time
of customer login on their site.
-
Persistent Customer Profiles: This approach can help build or maintain a persistent customer profile, ensuring the customer ID is available for any subsequent payment sessions without needing to call
createCustomeragain. -
Integration Flexibility: This is useful for merchants who want to initialize customer data early in the customer journey rather than during checkout.
The method you choose depends on your business requirements and how your
system is architected. Regardless of when you call it, the resulting
customer ID must be passed to the createSession API to initiate a
payment session.
description here
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/paysecure_api_documentation_live/apis/m_virtual_cards_payout_api.rb', line 97 def create_customer(brand_id, body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/v1/customer', Server::SERVER_3) .header_param(new_parameter(brand_id, key: 'BrandId') .is_required(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end)) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Success19.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', FailureException) .local_error('401', 'Unauthorized', ExistingCustomerException)) .execute end |
#create_pay_out(body) ⇒ ApiResponse
To Initiate a payout, the very first call to make is /payout/
with the required data in the request body.
To generate a Payout, you are required to provide the API key (in the
header) can be located in the Dashboard section of your merchant account
login.
The request body structure is shown on the request body of the example
request shown here.
description here
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/paysecure_api_documentation_live/apis/m_virtual_cards_payout_api.rb', line 165 def create_pay_out(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/v1/payout', Server::SERVER_3) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end)) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Success21.method(:from_hash)) .is_api_response(true)) .execute end |
#get_customer(brand_id, accept) ⇒ ApiResponse
This endpoint makes an HTTP GET request to retrieve customer information from the Paysecure API.
Request
The request does not include any query parameters, but it uses a raw request body with the following parameter "merchantCustomerId", which will be the customer id on the merchant's side.
Response
The response of this request can be documented as a JSON schema.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/paysecure_api_documentation_live/apis/m_virtual_cards_payout_api.rb', line 134 def get_customer(brand_id, accept) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/customer', Server::SERVER_2) .header_param(new_parameter(brand_id, key: 'BrandId') .is_required(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(accept, key: 'Accept') .is_required(true))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Success19.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', InvalidCustomerException)) .execute end |