Skip to content
Arthur Dias edited this page Jan 27, 2022 · 2 revisions

TIP: Remember that all functions use class "PAYPALPHP::".

NEW ORDER

  • To create a new order we will use "CreateOrder" function.
    • [Intent] The intent param is used to define the Paypal callback time, if set to 'CAPTURE' (or int 0) paypal must confirm the payment immediately after the customer makes a payment, otherwise, if set to 'AUTHORIZE' (or int 1) paypal will set the payment on hold so you need to manually authorize the payment, this action will happen after customer make the payment.
    • [Reference ID] Is your store order reference, so you can receive as a callback on IPS/IPN later.
    • [Description] Alfanumeric description for payment (max 129 chars).
    • [Price] Product price that would be charge. (use decimal, ex. "100.00")
<?php
    PAYPALPHP::CreateOrder($intent, $reference_id, $description, $price);
?>

The return will be in a JSON format (see the response here)

CAPTURE ORDER

  • To create a new order we will use "GetOrder" function.
    • [Order ID] To capture order you will need to inform the ORDER ID, the order id will be sent in the JSON callback when you create your order, you will need to store this ID to make further requests on future.
<?php
    PAYPALPHP::GetOrder($orderid);
?>

The return will be in a JSON format (see the response here)

Clone this wiki locally