CyberSource SDK v1.0.4 CyberSourceSDK View Source
This CyberSource module communicates with the Simple Order API service (SOAP) of CyberSource.
Link to this section Summary
Functions
Send an authorization request, making sure that the user have the necessary amount of money in his/her account.
Generate BillTo object to replace parameters in request XML
Send a capture request to charge the user account.
Pay with Android Pay request
Pay with Apple Pay request
Send a refund request o remove the hold on user money.
Called when an application is started.
Link to this section Functions
authorize(price, merchant_reference_code, card_type, encrypted_payment, bill_to \\ [], worker \\ :merchant) View Source
Send an authorization request, making sure that the user have the necessary amount of money in his/her account.
Parameters
- price: Float that represents the price to be charged to the user.
- merchant_reference_code: String that represents the order. Normally you should pass an unique identifier like
order_id
. - card_type: String with the name of card type, like VISA, MASTERCARD, etc.
- encrypted_payment: String that must be in Base64 received by Apple/Android payment system.
- bill_to: Structure generated by
CyberSourceSDK.bill_to()
. (Optional) - worker: Atom with name of the structure in configurations to be used. (Optional)
bill_to(first_name, last_name, street1, street2, city, country, email) View Source
Generate BillTo object to replace parameters in request XML
Examples
iex> CyberSourceSDK.bill_to("John", "Doe", "Main Street", "2 Left", "New York", "USA", "john@example.com")
[first_name: "John", last_name: "Doe", street1: "Main Street", street2: "2 Left", city: "New York", country: "USA", email: "john@example.com"]
capture(order_id, request_id, items \\ [], worker \\ :merchant) View Source
Send a capture request to charge the user account.
pay_with_android_pay(price, merchant_reference_code, card_type, encrypted_payment, bill_to \\ [], worker \\ :merchant) View Source
Pay with Android Pay request
pay_with_apple_pay(price, merchant_reference_code, card_type, encrypted_payment, bill_to \\ [], worker \\ :merchant) View Source
Pay with Apple Pay request
refund(order_id, request_id, items \\ [], worker \\ :merchant) View Source
Send a refund request o remove the hold on user money.
start(type, args) View Source
Called when an application is started.
This function is called when an application is started using
Application.start/2
(and functions on top of that, such as
Application.ensure_started/2
). This function should start the top-level
process of the application (which should be the top supervisor of the
application's supervision tree if the application follows the OTP design
principles around supervision).
start_type
defines how the application is started:
:normal
- used if the startup is a normal startup or if the application is distributed and is started on the current node because of a failover from another node and the application specification key:start_phases
is:undefined
.{:takeover, node}
- used if the application is distributed and is started on the current node because of a failover on the nodenode
.{:failover, node}
- used if the application is distributed and is started on the current node because of a failover on nodenode
, and the application specification key:start_phases
is not:undefined
.
start_args
are the arguments passed to the application in the :mod
specification key (e.g., mod: {MyApp, [:my_args]}
).
This function should either return {:ok, pid}
or {:ok, pid, state}
if
startup is successful. pid
should be the PID of the top supervisor. state
can be an arbitrary term, and if omitted will default to []
; if the
application is later stopped, state
is passed to the stop/1
callback (see
the documentation for the c:stop/1
callback for more information).
use Application
provides no default implementation for the start/2
callback.
Callback implementation for Application.start/2
.