diff --git a/sample/payments/AuthorizationCapture.php b/sample/payments/AuthorizationCapture.php index 6b064b9..d39e607 100644 --- a/sample/payments/AuthorizationCapture.php +++ b/sample/payments/AuthorizationCapture.php @@ -62,26 +62,26 @@ function createAuthorization($apiContext) $addr->setLine2("Niagara Falls"); $addr->setCity("Niagara Falls"); $addr->setState("NY"); - $addr->setPostal_code("14305"); - $addr->setCountry_code("US"); + $addr->setPostalCode("14305"); + $addr->setCountryCode("US"); $addr->setPhone("716-298-1822"); $card = new CreditCard(); $card->setType("visa"); $card->setNumber("4417119669820331"); - $card->setExpire_month("11"); - $card->setExpire_year("2019"); + $card->setExpireMonth("11"); + $card->setExpireYear("2019"); $card->setCvv2("012"); - $card->setFirst_name("Joe"); - $card->setLast_name("Shopper"); - $card->setBilling_address($addr); + $card->setFirstName("Joe"); + $card->setLastName("Shopper"); + $card->setBillingAddress($addr); $fi = new FundingInstrument(); - $fi->setCredit_card($card); + $fi->setCreditCard($card); $payer = new Payer(); - $payer->setPayment_method("credit_card"); - $payer->setFunding_instruments(array($fi)); + $payer->setPaymentMethod("credit_card"); + $payer->setFundingInstruments(array($fi)); $amount = new Amount(); $amount->setCurrency("USD"); diff --git a/sample/payments/CreatePayment.php b/sample/payments/CreatePayment.php index 7c34bb8..257226a 100644 --- a/sample/payments/CreatePayment.php +++ b/sample/payments/CreatePayment.php @@ -22,8 +22,8 @@ $addr->setLine1("3909 Witmer Road"); $addr->setLine2("Niagara Falls"); $addr->setCity("Niagara Falls"); $addr->setState("NY"); -$addr->setPostal_code("14305"); -$addr->setCountry_code("US"); +$addr->setPostalCode("14305"); +$addr->setCountryCode("US"); $addr->setPhone("716-298-1822"); // ### CreditCard @@ -32,12 +32,12 @@ $addr->setPhone("716-298-1822"); $card = new CreditCard(); $card->setType("visa"); $card->setNumber("4417119669820331"); -$card->setExpire_month("11"); -$card->setExpire_year("2019"); +$card->setExpireMonth("11"); +$card->setExpireYear("2019"); $card->setCvv2("012"); -$card->setFirst_name("Joe"); -$card->setLast_name("Shopper"); -$card->setBilling_address($addr); +$card->setFirstName("Joe"); +$card->setLastName("Shopper"); +$card->setBillingAddress($addr); // ### FundingInstrument // A resource representing a Payer's funding instrument. @@ -46,15 +46,15 @@ $card->setBilling_address($addr); // creating or using a tokenized funding instrument) // and the `CreditCardDetails` $fi = new FundingInstrument(); -$fi->setCredit_card($card); +$fi->setCreditCard($card); // ### Payer // A resource representing a Payer that funds a payment // Use the List of `FundingInstrument` and the Payment Method // as 'credit_card' $payer = new Payer(); -$payer->setPayment_method("credit_card"); -$payer->setFunding_instruments(array($fi)); +$payer->setPaymentMethod("credit_card"); +$payer->setFundingInstruments(array($fi)); // ### Amount // Let's you specify a payment amount. diff --git a/sample/payments/CreatePaymentUsingPayPal.php b/sample/payments/CreatePaymentUsingPayPal.php index 0f4163c..ea116e1 100644 --- a/sample/payments/CreatePaymentUsingPayPal.php +++ b/sample/payments/CreatePaymentUsingPayPal.php @@ -20,7 +20,7 @@ session_start(); // Use the List of `FundingInstrument` and the Payment Method // as 'credit_card' $payer = new Payer(); -$payer->setPayment_method("paypal"); +$payer->setPaymentMethod("paypal"); // ### Amount // Let's you specify a payment amount. @@ -42,8 +42,8 @@ $transaction->setDescription("This is the payment description."); // payment approval/ cancellation. $baseUrl = getBaseUrl(); $redirectUrls = new RedirectUrls(); -$redirectUrls->setReturn_url("$baseUrl/ExecutePayment.php?success=true"); -$redirectUrls->setCancel_url("$baseUrl/ExecutePayment.php?success=false"); +$redirectUrls->setReturnUrl("$baseUrl/ExecutePayment.php?success=true"); +$redirectUrls->setCancelUrl("$baseUrl/ExecutePayment.php?success=false"); // ### Payment // A Payment Resource; create one using @@ -51,7 +51,7 @@ $redirectUrls->setCancel_url("$baseUrl/ExecutePayment.php?success=false"); $payment = new Payment(); $payment->setIntent("sale"); $payment->setPayer($payer); -$payment->setRedirect_urls($redirectUrls); +$payment->setRedirectUrls($redirectUrls); $payment->setTransactions(array($transaction)); // ### Create Payment diff --git a/sample/payments/CreatePaymentUsingSavedCard.php b/sample/payments/CreatePaymentUsingSavedCard.php index 18fa312..dc93e4e 100644 --- a/sample/payments/CreatePaymentUsingSavedCard.php +++ b/sample/payments/CreatePaymentUsingSavedCard.php @@ -22,7 +22,7 @@ use PayPal\Auth\OAuthTokenCredential; // CreateCreditCard.php $creditCardId = 'CARD-5BT058015C739554AKE2GCEI'; $creditCardToken = new CreditCardToken(); -$creditCardToken->setCredit_card_id($creditCardId); +$creditCardToken->setCreditCardId($creditCardId); // ### FundingInstrument // A resource representing a Payer's funding instrument. @@ -31,15 +31,15 @@ $creditCardToken->setCredit_card_id($creditCardId); // creating or using a tokenized funding instrument) // and the `CreditCardDetails` $fi = new FundingInstrument(); -$fi->setCredit_card_token($creditCardToken); +$fi->setCreditCardToken($creditCardToken); // ### Payer // A resource representing a Payer that funds a payment // Use the List of `FundingInstrument` and the Payment Method // as 'credit_card' $payer = new Payer(); -$payer->setPayment_method("credit_card"); -$payer->setFunding_instruments(array($fi)); +$payer->setPaymentMethod("credit_card"); +$payer->setFundingInstruments(array($fi)); // ### Amount // Let's you specify a payment amount. @@ -70,7 +70,7 @@ $payment->setTransactions(array($transaction)); // The return object contains the status; try { $payment->create($apiContext); -} catch (PayPal\ExceptionPayPal\Exception\PPConnectionException $ex) { +} catch (PayPal\Exception\PPConnectionException $ex) { echo "Exception: " . $ex->getMessage() . PHP_EOL; var_dump($ex->getData()); exit(1); diff --git a/sample/payments/ExecutePayment.php b/sample/payments/ExecutePayment.php index 6827c99..ca87360 100644 --- a/sample/payments/ExecutePayment.php +++ b/sample/payments/ExecutePayment.php @@ -25,7 +25,7 @@ if(isset($_GET['success']) && $_GET['success'] == 'true') { // The payer_id is added to the request query parameters // when the user is redirected from paypal back to your site $execution = new PaymentExecution(); - $execution->setPayer_id($_GET['PayerID']); + $execution->setPayerId($_GET['PayerID']); //Execute the payment // (See bootstrap.php for more on `ApiContext`) @@ -37,4 +37,4 @@ if(isset($_GET['success']) && $_GET['success'] == 'true') { } else { echo "User cancelled payment."; -} \ No newline at end of file +} diff --git a/sample/payments/GetAuthorization.php b/sample/payments/GetAuthorization.php index 18a8a88..d57da8e 100644 --- a/sample/payments/GetAuthorization.php +++ b/sample/payments/GetAuthorization.php @@ -48,26 +48,26 @@ function createAuthorization($apiContext) $addr->setLine2("Niagara Falls"); $addr->setCity("Niagara Falls"); $addr->setState("NY"); - $addr->setPostal_code("14305"); - $addr->setCountry_code("US"); + $addr->setPostalCode("14305"); + $addr->setCountryCode("US"); $addr->setPhone("716-298-1822"); $card = new CreditCard(); $card->setType("visa"); $card->setNumber("4417119669820331"); - $card->setExpire_month("11"); - $card->setExpire_year("2019"); + $card->setExpireMonth("11"); + $card->setExpireYear("2019"); $card->setCvv2("012"); - $card->setFirst_name("Joe"); - $card->setLast_name("Shopper"); - $card->setBilling_address($addr); + $card->setFirstName("Joe"); + $card->setLastName("Shopper"); + $card->setBillingAddress($addr); $fi = new FundingInstrument(); - $fi->setCredit_card($card); + $fi->setCreditCard($card); $payer = new Payer(); - $payer->setPayment_method("credit_card"); - $payer->setFunding_instruments(array($fi)); + $payer->setPaymentMethod("credit_card"); + $payer->setFundingInstruments(array($fi)); $amount = new Amount(); $amount->setCurrency("USD"); diff --git a/sample/payments/GetCapture.php b/sample/payments/GetCapture.php index 194de6c..8db26af 100644 --- a/sample/payments/GetCapture.php +++ b/sample/payments/GetCapture.php @@ -71,26 +71,26 @@ function createAuthorization($apiContext) $addr->setLine2("Niagara Falls"); $addr->setCity("Niagara Falls"); $addr->setState("NY"); - $addr->setPostal_code("14305"); - $addr->setCountry_code("US"); + $addr->setPostalCode("14305"); + $addr->setCountryCode("US"); $addr->setPhone("716-298-1822"); $card = new CreditCard(); $card->setType("visa"); $card->setNumber("4417119669820331"); - $card->setExpire_month("11"); - $card->setExpire_year("2019"); + $card->setExpireMonth("11"); + $card->setExpireYear("2019"); $card->setCvv2("012"); - $card->setFirst_name("Joe"); - $card->setLast_name("Shopper"); - $card->setBilling_address($addr); + $card->setFirstName("Joe"); + $card->setLastName("Shopper"); + $card->setBillingAddress($addr); $fi = new FundingInstrument(); - $fi->setCredit_card($card); + $fi->setCreditCard($card); $payer = new Payer(); - $payer->setPayment_method("credit_card"); - $payer->setFunding_instruments(array($fi)); + $payer->setPaymentMethod("credit_card"); + $payer->setFundingInstruments(array($fi)); $amount = new Amount(); $amount->setCurrency("USD"); diff --git a/sample/payments/RefundCapture.php b/sample/payments/RefundCapture.php index 7988a5f..2d8ec26 100644 --- a/sample/payments/RefundCapture.php +++ b/sample/payments/RefundCapture.php @@ -83,26 +83,26 @@ function createAuthorization($apiContext) $addr->setLine2("Niagara Falls"); $addr->setCity("Niagara Falls"); $addr->setState("NY"); - $addr->setPostal_code("14305"); - $addr->setCountry_code("US"); + $addr->setPostalCode("14305"); + $addr->setCountryCode("US"); $addr->setPhone("716-298-1822"); $card = new CreditCard(); $card->setType("visa"); $card->setNumber("4417119669820331"); - $card->setExpire_month("11"); - $card->setExpire_year("2019"); + $card->setExpireMonth("11"); + $card->setExpireYear("2019"); $card->setCvv2("012"); - $card->setFirst_name("Joe"); - $card->setLast_name("Shopper"); - $card->setBilling_address($addr); + $card->setFirstName("Joe"); + $card->setLastName("Shopper"); + $card->setBillingAddress($addr); $fi = new FundingInstrument(); - $fi->setCredit_card($card); + $fi->setCreditCard($card); $payer = new Payer(); - $payer->setPayment_method("credit_card"); - $payer->setFunding_instruments(array($fi)); + $payer->setPaymentMethod("credit_card"); + $payer->setFundingInstruments(array($fi)); $amount = new Amount(); $amount->setCurrency("USD"); diff --git a/sample/payments/VoidAuthorization.php b/sample/payments/VoidAuthorization.php index c5e07e3..ddddc76 100644 --- a/sample/payments/VoidAuthorization.php +++ b/sample/payments/VoidAuthorization.php @@ -49,26 +49,26 @@ function createAuthorization($apiContext) $addr->setLine2("Niagara Falls"); $addr->setCity("Niagara Falls"); $addr->setState("NY"); - $addr->setPostal_code("14305"); - $addr->setCountry_code("US"); + $addr->setPostalCode("14305"); + $addr->setCountryCode("US"); $addr->setPhone("716-298-1822"); $card = new CreditCard(); $card->setType("visa"); $card->setNumber("4417119669820331"); - $card->setExpire_month("11"); - $card->setExpire_year("2019"); + $card->setExpireMonth("11"); + $card->setExpireYear("2019"); $card->setCvv2("012"); - $card->setFirst_name("Joe"); - $card->setLast_name("Shopper"); - $card->setBilling_address($addr); + $card->setFirstName("Joe"); + $card->setLastName("Shopper"); + $card->setBillingAddress($addr); $fi = new FundingInstrument(); - $fi->setCredit_card($card); + $fi->setCreditCard($card); $payer = new Payer(); - $payer->setPayment_method("credit_card"); - $payer->setFunding_instruments(array($fi)); + $payer->setPaymentMethod("credit_card"); + $payer->setFundingInstruments(array($fi)); $amount = new Amount(); $amount->setCurrency("USD"); diff --git a/sample/source/AuthorizationCapture.html b/sample/source/AuthorizationCapture.html index 5042253..3bc228e 100644 --- a/sample/source/AuthorizationCapture.html +++ b/sample/source/AuthorizationCapture.html @@ -52,26 +52,26 @@ The return object contains the status;
Creates the credit card as a resource
in the PayPal vault. The response contains
@@ -27,7 +27,7 @@ an 'id' that you can use to refer to it
in the future payments.
(See bootstrap.php for more on ApiContext)
A resource representing a credit card that can be used to fund a payment.
A resource representing a Payer's funding instrument.
Use a Payer ID (A unique identifier of the payer generated
and provided by the facilitator. This is required when
creating or using a tokenized funding instrument)
and the CreditCardDetails
A resource representing a Payer that funds a payment
Use the List of FundingInstrument and the Payment Method
as 'credit_card'
Let's you specify a payment amount.
Let's you specify a payment amount.
Payee and Amount typesA Payment Resource; create one using the above types and intent as 'sale'
Create a payment by posting to the APIService diff --git a/sample/source/CreatePaymentUsingSavedCard.html b/sample/source/CreatePaymentUsingSavedCard.html index 07417ff..fa4aeec 100644 --- a/sample/source/CreatePaymentUsingSavedCard.html +++ b/sample/source/CreatePaymentUsingSavedCard.html @@ -17,20 +17,20 @@ API used: /v1/payments/payment
A resource representing a Payer's funding instrument.
Use a Payer ID (A unique identifier of the payer generated
and provided by the facilitator. This is required when
creating or using a tokenized funding instrument)
and the CreditCardDetails
A resource representing a Payer that funds a payment
Use the List of FundingInstrument and the Payment Method
as 'credit_card'
Let's you specify a payment amount.
Creates the credit card as a resource
in the PayPal vault. The response contains
@@ -24,7 +24,7 @@ an 'id' that you can use to refer to it
in the future payments.
(See bootstrap.php for more on ApiContext)
deletes saved credit card
(See bootstrap.php for more on ApiContext)
(See bootstrap.php for more on ApiContext)
The cardId can be obtained from a previous save credit -card operation. Use $card->getId()
(See bootstrap.php for more on ApiContext)
Save card
+$card->setFirstName("Joe"); +$card->setLastName("Shopper");