Jump to content

how to automate direct to an order via api(paypal),already create order


sidealice

Recommended Posts

following is my code.. but that didn't take effect? i mean that didn't take me to the paypal's payment page and return. could you help me?

 

$url = "http://www.xxx.com/billing/includes/api.php";

$username = ""; # Admin username goes here

$password = " xxx"; # Admin password goes here

 

 

 

$postfields["action"] = "addorder";

$postfields["clientid"] = $results["clientid"];

$postfields["pid"] = "1";

$postfields["billingcycle"] = "daily";

$postfields["regperiod"] = "1";

$postfields["paymentmethod"] = "paypal";

 

 

 

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_TIMEOUT, 100);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

$data = curl_exec($ch);

curl_close($ch);

 

$data = explode(";",$data);

foreach ($data AS $temp) {

$temp = explode("=",$temp);

$results[$temp[0]] = $temp[1];

}

 

if ($results["result"]=="success") {

echo "<br />Order ID:".$results["orderid"]." has been created!";

echo "<br />Invoice ID:".$results["invoiceid"]." has been created!";

 

 

} else {

echo "<br />The following error occured: ".$results["message"];

}

 

 

many thanks

Link to comment
Share on other sites

  • 3 years later...

I've got to say this seems to be a topic that really isnt covered. I've searched and searched and Just can't seem to find anything on this.

 

Can someone advise/suggest and ideas?

 

I mean, do we have to deal with the paypal API as well or does the WHMCS API still deal with paypal?

The API is quite clear on how to Add an Invoice payment, Capture a credit card payment, Add an order, etc but there's really not any useful information on how paypal works with the API and generated orders/invoices....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated