Paypal.Order (Paypal v0.1.1)
View SourceThe orders is the element that let us to charge an amount to the clients.
We have to ways to proceed, it's called the intent
and depending on what
you choose, it will let you charge the money instantly or hold the money
until the process, product or service will be released.
capture
is the intent that charge the money immediately. The flow is:- Crete the order using
capture
as the intent, seecreate/2
. - Use the URL inside of the response for approving the payment.
- Capture the money, see
capture/1
.
- Crete the order using
authorize
is the intent that hold the money and it will let you capture the fonds later. The flow is:- Create the order using
authorize
as the intent, seecreate/2
. - Use the URL inside of the response for approving the payment.
- Create the authorization, see
authorize/1
. - Capture fonds using the authorization, see
Paypal.Payment.capture/1
.
- Create the order using
If you are interested on the authorization, check Paypal.Payment
module for
further information.
Summary
Functions
Create an order.
The kind of intents, for further information Paypal.Order
.
Statuses for the order. The order is following different states, we could illustrate it as a state diagram
Functions
@spec create( :capture | :authorize, [Paypal.Order.PurchaseUnit.t() | map()], Paypal.Order.ExperienceContext.t() | map() ) :: {:ok, Paypal.Order.Info.t()} | {:error, Paypal.Common.Error.t() | String.t()}
Create an order.
The kind of intents, for further information Paypal.Order
.
Statuses for the order. The order is following different states, we could illustrate it as a state diagram:
stateDiagram-v2
[*] --> CREATED
CREATED --> PAYER_ACTION_REQUIRED
PAYER_ACTION_REQUIRED --> APPROVED
APPROVED --> SAVED
SAVED --> APPROVED
APPROVED --> VOIDED
APPROVED --> COMPLETED
VOIDED --> [*]
COMPLETED --> [*]
As you can see, we start in CREATED state and we are moving until reach VOIDED or COMPLETED.