Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7950681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:20:53+00:00 2026-06-04T02:20:53+00:00

I am at my wits end trying to get this work but cant understand

  • 0

I am at my wits end trying to get this work but cant understand it. I have to use Adaptive payments in a webapp which is created using cakephp framework. I have API credentials like API Username, Password and Signature. But the main problem i am facing is how to call the Pay API to get the API key which is the first thing required to make this work. I am new to this so i dont have much knowledge about this and after lot digging in google i am asking this question. Can someone please give steps for using Adaptive Payments..

Thanks in advance for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:20:55+00:00Added an answer on June 4, 2026 at 2:20 am

    You have to follow only three steps:

    1- You send a PayRequest message to PayPal

    {“returnUrl”:”http://example.com/returnURL.htm”, \ “requestEnvelope”:{“errorLanguage”:”en_US”},”currencyCode”:”USD”, \ “receiverList”:{“receiver”:[{“email”:”david@example.com”, \
    “amount”:”10.00″,}]},”cancelUrl”:”http://example.com/cancelURL.htm”,\ “actionType”:”PAY”}

    2- You receive a response with a pay key.

    {“responseEnvelope”:\ {“timestamp”:”2009-10-06T14:30:39.383-07:00″,”ack”:”Success”,\ “correlationId”:”cfe8f8783f1d3″,”build”:”DEV”},\ “payKey”:”AP-17266198048308436″,”paymentExecStatus”:”CREATED”}

    3- You must redirect the sender’s browser to PayPal to approve the payment.

    This would be an example code for step 1 (it works on my local server):

    <?php
    
    //turn php errors on
    ini_set("track_errors", true);
    
    //set PayPal Endpoint to sandbox
    $url = trim("https://svcs.sandbox.paypal.com/AdaptivePayments/Pay");
    
    $api_appid = 'APP-80W284485P519543T';   // para sandbox
    
    //PayPal API Credentials
    $API_UserName = "sbapi_1287090601_biz_api1.paypal.com"; //TODO
    $API_Password = "1287090610"; //TODO
    $API_Signature = "ANFgtzcGWolmjcm5vfrf07xVQ6B9AsoDvVryVxEQqezY85hChCfdBMvY"; //TODO
    $receiver_email = "fake@email.com"; //TODO
    $amount = 25; //TODO
    
    //Default App ID for Sandbox    
    $API_AppID = "APP-80W284485P519543T";
    
    $API_RequestFormat = "NV";
    $API_ResponseFormat = "NV";
    
    
    //Create request payload with minimum required parameters
    $bodyparams = array (   "requestEnvelope.errorLanguage" => "en_US",
                      "actionType" => "PAY",
                      "cancelUrl" => "http://cancelUrl",
                      "returnUrl" => "http://returnUrl",
                      "currencyCode" => "EUR",
                      "receiverList.receiver.email" => $receiver_email,
                      "receiverList.receiver.amount" => $amount
        );
    
    // convert payload array into url encoded query string
    $body_data = http_build_query($bodyparams, "", chr(38));
    
    
    try
    {
    
    //create request and add headers
    $params = array("http" => array(
        "method" => "POST",                                                 
        "content" => $body_data,                                             
        "header" =>  "X-PAYPAL-SECURITY-USERID: " . $API_UserName . "\r\n" .
                     "X-PAYPAL-SECURITY-SIGNATURE: " . $API_Signature . "\r\n" .
                     "X-PAYPAL-SECURITY-PASSWORD: " . $API_Password . "\r\n" .
                     "X-PAYPAL-APPLICATION-ID: " . $API_AppID . "\r\n" .
                     "X-PAYPAL-REQUEST-DATA-FORMAT: " . $API_RequestFormat . "\r\n" .
                     "X-PAYPAL-RESPONSE-DATA-FORMAT: " . $API_ResponseFormat . "\r\n"
    ));
    
    
    //create stream context
     $ctx = stream_context_create($params);
    
    
    //open the stream and send request
     $fp = @fopen($url, "r", false, $ctx);
    
    //get response
     $response = stream_get_contents($fp);
    
    //check to see if stream is open
     if ($response === false) {
        throw new Exception("php error message = " . "$php_errormsg");
     }
    
    //close the stream
     fclose($fp);
    
    //parse the ap key from the response
    
    $keyArray = explode("&", $response);
    
    foreach ($keyArray as $rVal){
        list($qKey, $qVal) = explode ("=", $rVal);
            $kArray[$qKey] = $qVal;
    }
    
    //print the response to screen for testing purposes
    If ( $kArray["responseEnvelope.ack"] == "Success") {
    
         foreach ($kArray as $key =>$value){
        echo $key . ": " .$value . "<br/>";
    }
     }
    else {
        echo 'ERROR Code: ' .  $kArray["error(0).errorId"] . " <br/>";
      echo 'ERROR Message: ' .  urldecode($kArray["error(0).message"]) . " <br/>";
    }
    
    }
    
    
    catch(Exception $e) {
    echo "Message: ||" .$e->getMessage()."||";
    }
    
    ?>
    

    You have many examples here: https://www.x.com/developers/paypal/documentation-tools/paypal-code-samples

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm at my wits end trying to solve this one. I have scripts and
I have a very simple arithmetic operator but am at my wits end why
I'm beginning to get to my wit's end on this one. I have Jenkins
This should be dead simple, but I cannot get it to work for the
I'm at my wits end right now trying to get a website working in
This exact question has been asked before but I am at my wits end!
I'm kinda at my wit's end trying to get my Java game to work
I’m at my wit’s end trying to figure this out. I'm experienced in WPF,
I'm at my wits end, and it's probably something really simple. Basically I've have
I can't believe I'm having to ask this, but I'm at my wit's end.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.