Example #1
0
 */
 $requestEnvelope = new RequestEnvelope("en_US");
 /*
 *  CreateInvoiceRequest which takes mandatory params:
 		
 		 * `Request Envelope` - Information common to each API operation, such
 		 as the language in which an error message is returned.
 		 * `Invoice` - Merchant, payer, and invoice information.
 */
 $createInvoiceRequest = new CreateInvoiceRequest($requestEnvelope, $invoice);
 /*
 	 *  ## Creating service wrapper object
 		 Creating service wrapper object to make API call and loading
 		 Configuration::getAcctAndConfig() returns array that contains credential and config parameters
 */
 $invoiceService = new InvoiceService(Configuration::getAcctAndConfig());
 // required in third party permissioning
 if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
     $cred = new PPSignatureCredential("jb-us-seller_api1.paypal.com", "WX4WTU3S8MY44S7F", "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy");
     $cred->setThirdPartyAuthorization(new PPTokenAuthorization($_POST['accessToken'], $_POST['tokenSecret']));
 }
 try {
     /*
     *  ## Making API call
     			 Invoke the appropriate method corresponding to API in service
     			 wrapper object
     */
     if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
         $createInvoiceResponse = $invoiceService->CreateInvoice($createInvoiceRequest, $cred);
     } else {
         $createInvoiceResponse = $invoiceService->CreateInvoice($createInvoiceRequest);
$parts = Explode('/', $currentFile);
$currentFile = $parts[count($parts) - 1];
$_SESSION['curFile'] = $currentFile;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // create request object
    $requestEnvelope = new RequestEnvelope("en_US");
    /*
     * (Required) ID of the invoice to mark as unpaid. 
     */
    $markInvoiceAsUnpaidRequest = new MarkInvoiceAsUnpaidRequest($requestEnvelope, $_POST['invoiceID']);
    /*
    	 * 	 ## Creating service wrapper object
    	Creating service wrapper object to make API call and loading
    	Configuration::getAcctAndConfig() returns array that contains credential and config parameters
    */
    $invoiceService = new InvoiceService(Configuration::getAcctAndConfig());
    // required in third party permissioning
    if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
        $cred = new PPSignatureCredential("jb-us-seller_api1.paypal.com", "WX4WTU3S8MY44S7F", "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy");
        $cred->setThirdPartyAuthorization(new PPTokenAuthorization($_POST['accessToken'], $_POST['tokenSecret']));
    }
    try {
        if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
            $markInvoiceAsUnpaidResponse = $invoiceService->MarkInvoiceAsUnpaid($markInvoiceAsUnpaidRequest, $cred);
        } else {
            $markInvoiceAsUnpaidResponse = $invoiceService->MarkInvoiceAsUnpaid($markInvoiceAsUnpaidRequest);
        }
    } catch (Exception $ex) {
        require_once 'error.php';
        exit;
    }
 */
 $requestEnvelope = new RequestEnvelope("en_US");
 /*
 *  GetInvoiceDetailsRequest which takes mandatory params:
 		
 		 * `Request Envelope` - Information common to each API operation, such
 		 as the language in which an error message is returned.
 		 * `Invoice ID` - ID of the invoice to retrieve.
 */
 $getInvoiceDetailsRequest = new GetInvoiceDetailsRequest($requestEnvelope, $_POST['invoiceID']);
 /*
 	 *  ## Creating service wrapper object
 		 Creating service wrapper object to make API call and loading
 		 Configuration::getAcctAndConfig() returns array that contains credential and config parameters
 */
 $invoiceService = new InvoiceService(Configuration::getAcctAndConfig());
 // required in third party permissioning
 if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
     $cred = new PPSignatureCredential("jb-us-seller_api1.paypal.com", "WX4WTU3S8MY44S7F", "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy");
     $cred->setThirdPartyAuthorization(new PPTokenAuthorization($_POST['accessToken'], $_POST['tokenSecret']));
 }
 try {
     /*
     *  ## Making API call
     					 Invoke the appropriate method corresponding to API in service
     					 wrapper object
     */
     if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
         $getInvoiceDetailsResponse = $invoiceService->GetInvoiceDetails($getInvoiceDetailsRequest, $cred);
     } else {
         $getInvoiceDetailsResponse = $invoiceService->GetInvoiceDetails($getInvoiceDetailsRequest);
Example #4
0
 *  SearchInvoicesRequest which takes mandatory params:
 		
 		 * `Request Envelope` - Information common to each API operation, such
 		 as the language in which an error message is returned.
 		 * `Merchant Email` - Email address of invoice creator.
 		 * `SearchParameters` - Parameters constraining the search.
 		 * `Page` - Page number of result set, starting with 1.
 		 * `Page Size` - Number of results per page, between 1 and 100.
 */
 $searchInvoicesRequest = new SearchInvoicesRequest($requestEnvelope, $merchantEmail, $parameters, $page, $pageSize);
 /*
 	 *  ## Creating service wrapper object
 		 Creating service wrapper object to make API call and loading
 		 Configuration::getAcctAndConfig() returns array that contains credential and config parameters
 */
 $invoiceService = new InvoiceService(Configuration::getAcctAndConfig());
 // required in third party permissioning
 if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
     $cred = new PPSignatureCredential("jb-us-seller_api1.paypal.com", "WX4WTU3S8MY44S7F", "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy");
     $cred->setThirdPartyAuthorization(new PPTokenAuthorization($_POST['accessToken'], $_POST['tokenSecret']));
 }
 try {
     /*
     *  ## Making API call
     			 Invoke the appropriate method corresponding to API in service
     			 wrapper object
     */
     if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
         $searchInvoicesResponse = $invoiceService->SearchInvoices($searchInvoicesRequest, $cred);
     } else {
         $searchInvoicesResponse = $invoiceService->SearchInvoices($searchInvoicesRequest);
 /**
  * @test
  */
 public function testCreateAndSendInvoice()
 {
     $item1 = new InvoiceItemType('item_name1', '1', '1');
     $item2 = new InvoiceItemType('item_name2', '2', '2');
     $items = array($item1, $item2);
     $itemList = new InvoiceItemListType();
     $itemList->item = $items;
     $invoice = new InvoiceType('*****@*****.**', '*****@*****.**', $itemList, 'USD', 'DueOnReceipt');
     $requestEnvelope = new RequestEnvelope();
     $requestEnvelope->errorLanguage = "en_US";
     $createInvoiceRequest = new CreateInvoiceRequest($requestEnvelope, $invoice);
     $invoice_service = new InvoiceService();
     $ret = $invoice_service->CreateAndSendInvoice($createInvoiceRequest, 'jb-us-seller_api1.paypal.com');
     $this->assertNotNull($ret);
     $this->assertNotNull($ret->invoiceID);
     $this->assertEquals(0, count($ret->error));
 }
 /*
  * (Required) Information common to each API operation, such as the language in which an error message is returned. 
  */
 $requestEnvelope = new RequestEnvelope("en_US");
 $refundDetails = new OtherPaymentRefundDetailsType();
 if ($_POST['note'] != "") {
     $refundDetails->note = $_POST['note'];
 }
 if ($_POST['refundDate'] != "") {
     $refundDetails->date = $_POST['refundDate'];
 }
 $markInvoiceAsRefundedRequest = new MarkInvoiceAsRefundedRequest($requestEnvelope, $_POST['invoiceID'], $refundDetails);
 /*
 		 Configuration::getAcctAndConfig() returns array that contains credential and config parameters
 */
 $invoiceService = new InvoiceService(Configuration::getAcctAndConfig());
 // required in third party permissioning
 if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
     $cred = new PPSignatureCredential("jb-us-seller_api1.paypal.com", "WX4WTU3S8MY44S7F", "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy");
     $cred->setThirdPartyAuthorization(new PPTokenAuthorization($_POST['accessToken'], $_POST['tokenSecret']));
 }
 try {
     if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
         $markInvoiceAsRefundedResponse = $invoiceService->MarkInvoiceAsRefunded($markInvoiceAsRefundedRequest, $cred);
     } else {
         $markInvoiceAsRefundedResponse = $invoiceService->MarkInvoiceAsRefunded($markInvoiceAsRefundedRequest);
     }
 } catch (Exception $ex) {
     require_once 'error.php';
     exit;
 }
Example #7
0
 // create request object
 /*
  * (Required) RFC 3066 language in which error messages are returned; by default it is en_US, which is the only language currently supported. 
  */
 $requestEnvelope = new RequestEnvelope("en_US");
 $cancelInvoiceRequest = new CancelInvoiceRequest($requestEnvelope);
 /*
  * (Optional) ID of the invoice. 
  */
 $cancelInvoiceRequest->invoiceID = $_POST['invoiceID'];
 /*
  * 	 ## Creating service wrapper object
 Creating service wrapper object to make API call and loading
 Configuration::getAcctAndConfig() returns array that contains credential and config parameters
 */
 $invoiceService = new InvoiceService(Configuration::getAcctAndConfig());
 // required in third party permissioning
 if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
     $cred = new PPSignatureCredential("jb-us-seller_api1.paypal.com", "WX4WTU3S8MY44S7F", "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy");
     $cred->setThirdPartyAuthorization(new PPTokenAuthorization($_POST['accessToken'], $_POST['tokenSecret']));
 }
 try {
     /* wrap API method calls on the service object with a try catch */
     if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
         $cancelInvoiceResponse = $invoiceService->CancelInvoice($cancelInvoiceRequest, $cred);
     } else {
         $cancelInvoiceResponse = $invoiceService->CancelInvoice($cancelInvoiceRequest);
     }
 } catch (Exception $ex) {
     require_once 'error.php';
     exit;
Example #8
0
 $requestEnvelope = new RequestEnvelope("en_US");
 /*
 * 
 		 SendInvoiceRequest which takes mandatory params:
 		
 		 * `Request Envelope` - Information common to each API operation, such
 		 as the language in which an error message is returned.
 		 * `Invoice ID` - ID of the invoice to send.
 */
 $sendInvoiceRequest = new SendInvoiceRequest($requestEnvelope, $_POST['invoiceID']);
 /*
 	 *  ## Creating service wrapper object
 		 Creating service wrapper object to make API call and loading
 		 Configuration::getAcctAndConfig() returns array that contains credential and config parameters
 */
 $invoiceService = new InvoiceService(Configuration::getAcctAndConfig());
 // required in third party permissioning
 if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
     $cred = new PPSignatureCredential("jb-us-seller_api1.paypal.com", "WX4WTU3S8MY44S7F", "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy");
     $cred->setThirdPartyAuthorization(new PPTokenAuthorization($_POST['accessToken'], $_POST['tokenSecret']));
 }
 try {
     /*
     *  ## Making API call
     			 Invoke the appropriate method corresponding to API in service
     			 wrapper object
     */
     if ($_POST['accessToken'] != null && $_POST['tokenSecret'] != null) {
         $sendInvoiceResponse = $invoiceService->SendInvoice($sendInvoiceRequest, $cred);
     } else {
         $sendInvoiceResponse = $invoiceService->SendInvoice($sendInvoiceRequest);