Welcome! Log In Create A New Profile

Advanced

[WD16] Prepayment by PayPal

Posted by Ola 
Ola
[WD16] Prepayment by PayPal
October 23, 2012 01:00PM
Hi all

I would like to add some PayPal-automation to my ERP, to activate the prepayment process for a sales order. Basically I just need to send to Paypal the info about my account, the buyer's email, a short description of the goods and the total sum to be billed (no detail info, no tax info etc...) and then let PP handle it automatically so that I wouldn't have to do the PayPal invoice manually myself.

Obviously the easiest way to do this would be to send an email with preformatted csv or xml contents to PayPal, but I think this kind of service is not available?

So what would be the easiest way to achieve this, in Windev 16 (or 17)?

Best regards
Ola
Chris du Toit
Re: [WD16] Prepayment by PayPal
October 23, 2012 01:39PM
Hi Ola -

I've integrated with Paypal from a website (non Wcool smiley before. They have an extensive http based API - so in essence, you make a series of http calls. I'm sure you can mimic this with the HTTPRequest command in WD. For Paypal express, as far as I remember, you just post a HTML form with all the attributes set.

That said - They also have a webservices API so that should do the trick too. The nice thing is that paypal has a developer sandbox so you can test your code.

If you don't feel like call this API, I know there are some commercial paypal .NET components that may be worth looking into, but I think you'll find the paypal api fairly straightforward.



Edited 1 time(s). Last edit at 10/23/2012 02:12PM by Chris du Toit.
Paulo Oliveira
Re: [WD16] Prepayment by PayPal
October 23, 2012 01:51PM
As far as i can remember there are some stuff about this on the online repository of the pcsoft web site.

[repository.windev.com]
Ola
Re: [WD16] Prepayment by PayPal
October 23, 2012 11:25PM
Thanks for the hints

@Chris: I am looking for a solution for Windev, not Webdev. I understand you are referring to solutions that are more suitable for Webdev?

@Paulo: I will check the repository stuff. If seems to be for only paying by credit card, not for producing the invoice, but it may give some more hints.

best regards
Ola
Chris du Toit
Re: [WD16] Prepayment by PayPal
October 24, 2012 12:21PM
Actually I think those options will work just fine from Windev too. Especially the WebServices API:

[developer.paypal.com]
Ola
Re: [WD16] Prepayment by PayPal
October 24, 2012 07:51PM
Hi Chris,

Thank you for the document.

I waded through the PP_APIReference, and the nearest thing I found applicable to my needs, activating a prepayment, was the "Direct Payment API".

However, this seems to be geared towards doing the business in web only; information is exchanged between a web site and PayPal. PayPal sends the response to an URL.

Surely I can later find use for this too, but it seems to be of no help, if I am handling an order or subscription received by phone or email and want to activate the prepayment process from a Lan/desktop/windows application (and get the response by email).

Or am I missing something?

best regards
Ola
Ola
Re: [WD16] Prepayment by PayPal
October 25, 2012 07:01PM
Creating and sending PayPal invoices with Windev 16 (in Windows 7)

I found the following document which seems to describe the functions I need:
[cms.paypal.com]

Also I read (among many other PayPal pages) :
[www.x.com]
It refers to a "New" invoice API, but does not give the year it is written in!

Anyways, there are the CreateAndSendInvoiceRequest and CreateAndSendInvoiceResponse messages which would be useable, but I have no experience of APIs, and there are so many weird three and 4 letter acronyms :-), so a lot of questions arise:

- Where/how to start?
- There ase several SDKs for invoicing (dotnet etc.)
What is the correct SDK file for use with WinDev on Windows platform?
- Where should it be placed in relation to my Windev app or exe?
- How do I activate it / refer to it in Windev?
- How do I start to build the invoice message in Windev?
- There are three alternative formats to use for the data:
NV = name-value pairs, XML and JSON.
I don't know anything about JSON.
I have done some XML in Windev, still I assume that
NV might be the easiest/fastest format to code, but
what would be the Windev syntax for it?
- How do I connect to PayPal from Windev?
- How do I send the request message to PayPal from Windev?
- How do I capture the response message from PayPal to Windev?
- Can this be done in Windev's procedural code?
Or do I finally have to start learning the POO too?
- What question have I missed?:-)

I appreciate any help on this subject, and any sample code snippets would be just swell.
When I get the basic Windev questions cleared, I can ask more info from PayPal, if necessary.

best regards
Ola

P.S. Below are some simple samples from PayPal. How would they look in WLanguage?

1. Obtain the endpoint for the service and environment you are addressing.

The Sandbox endpoint for the Invoicing Pay operation is: 
  [api-3t.sandbox.paypal.com]

This is the endpoint for a name/value pair in the Sandbox; for other endpoints see API Endpoints.

2. Format the HTTP headers needed to make the call.
	// Sandbox API credentials for the API Caller account
	-H "X-PAYPAL-SECURITY-USERID: Sandbox-Caller-User-Id
	-H "X-PAYPAL-SECURITY-PASSWORD: Sandbox-Caller-Password
	-H "X-PAYPAL-SECURITY-SIGNATURE: Sandbox-Caller-Security-Signature
	// Global Sandbox Application ID
	-H "X-PAYPAL-APPLICATION-ID: APP-5XV204960S3290106"

3. The response contains a timestamp, status, invoice ID, and invoice URL:
{
    "responseEnvelope": {
        "timestamp": "2011-06-16T:12:30.861-07:00",
        "ack": "Success",
        "correlationId": "78733df04b1f0",
        "build": "1942837"
    },
    "invoiceID": "INV2-C4AK-UU3J-5SCL-9KZY",
    "invoiceNumber": "1192",
    "invoiceURL": "invoiceURL"
}

VoilĂ ! You have created and sent an invoice using the Invoicing API.

Try It!

curl -s --insecure -H "X-PAYPAL-SECURITY-USERID:caller_1312486258_biz_api1.gmail.com" -H "X-PAYPAL-SECURITY-PASSWORD:1312486294" -H "X-PAYPAL-SECURITY-SIGNATURE:AbtI7HV1xB428VygBUcIhARzxch4AL65.T18CTeylixNNxDZUu0iO87e" -H "X-PAYPAL-REQUEST-DATA-FORMAT:NV" -H "X-PAYPAL-RESPONSE-DATA-FORMAT:JSON" -H "X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T" [svcs.sandbox.paypal.com] -d "requestEnvelope.errorLanguage=en_US&invoice.merchantEmail=caller_1312486258_biz@gmail.com&invoice.payerEmail=sender_1334790586_per@x.com&invoice.currencyCode=USD&invoice.paymentTerms=DueOnReceipt&invoice.itemList.item(0).name=BananaPlant&invoice.itemList.item(0).quantity=1&invoice.itemList.item(0).unitPrice=12"
bosher
Re: [WD16] Prepayment by PayPal
October 30, 2012 07:06PM
Not sure if this is helpful but you could look at the paypal component that allegedly works in Webdev and Windev from here www.scriptfactor.com

Never tried it.

However, I did make a windev version (global procedure) of this a long time ago.
[www.tatam.fr]

It worked...

Cheers

Bosher
Ola (not logged in)
Re: [WD16] Prepayment by PayPal
October 30, 2012 08:59PM
Hi Bosher

I actually bought the PayPal script from www.scriptfactor.com. It is for web/Webdev(also advertized for Windev) use and I find it a little bit difficult to understand. I haven't yet found a general documentation from it to describe the steps needed to make it work (especially with Windev).

On the other hand, your PayPal tutorial is excellent, very simple, very well documented. Thank you. But it is also for web, so I am still bouncing in the dark on how to transfer an invoice to PayPal from Windev.

Best regards
Ola
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: