Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

braintreedev/sample-13-paypal-ap-preapprovals-php

Repository files navigation

This repo is on a path to being archived, checkout our other resources in github.com/paypal

Using the PayPal Adaptive Payment API in PHP to make a Pre-Approval payment

This is an example of the PayPal Adaptive Payment API in PHP to make a Pre-Approval payment.

This code does not use an SDK although it uses a basic wrapper to handle the NVP API. You can use this library as a drop in for your project.

Technology

This demo uses

  • PHP

Running the demo

  • Clone this repo git clone https://github.com/commercefactory/paypal-adaptive-payments-preapprovals-php.git
  • Change into the folder cd paypal-adaptive-payments-preapprovals-php
  • Initialise the submodule git submodule init
  • Update the submodule git submodule update
  • Run php -S 127.0.0.1:8080 to start the app (requires PHP 5.4 or above) or load it in your web server of choice.
  • Visit http://127.0.0.1:8080/ in your browser
  • Click the "Make a payment" link
  • You will be redirected to PayPal
  • Login using the following credentials:
    • Username: us-customer@commercefactory.org
    • Password: test1234
  • Complete the payment instructions
  • You will receive a message that says "Pre-approval accepted"
  • Now click the link to actually capture the payment
  • You will receive a message that says "Transaction completed"

Running the test

  • Requirements:
  • Start the app by running php -S 127.0.0.1:8080
  • Load the test script in the Selenium IDE and run the script. Note if you are running the webserver of your choice you will need to change the base url in the test script to match.

Useful link

About

A Pre-Approval payment using PayPal Adaptive Payment API in PHP.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published