This Package is a PHP SDK wrapper around version 2 of the PayPal rest API. It provides a simple, fluent API to create and capture orders with both sandbox and production environments supported.
Here are some quick code examples of what you can do:
Create an Order
// Create a purchase unit with the total amount$purchase_unit =newPurchaseUnit(AmountBreakdown::of('100.00'));// Create & add item to purchase unit$purchase_unit->addItem(Item::make('Item 1','100.00','USD',1));// Create a new order with intent to capture a payment$order = (newOrder())->addPurchaseUnit($purchase_unit);// Send request to PayPal$response = $client->send(newOrderCreateRequest($order));
Show an Order
// Create an order show http request$request =newOrderShowRequest($order_id);// Send request to PayPal$response = $client->send($request);// Get results$result =json_decode($response->getBody()->getContents());
Capture an Order
// Create an order capture http request$request =newOrderCaptureRequest($order_id);// Send request to PayPal$response = $client->send($request);// Get results$result =json_decode($response->getBody()->getContents());