Genexus + PayPal
Publicado por Enrique Avila (4 intervenciones) el 13/07/2016 10:25:18
Hola, buen día.
Hay alguien que haya realizado alguna integración de PayPal para genexus. He estado probando algo que me encontré el la Wiki, sin embargo al probarlo recibo error.
La cadena de consulta queda algo asi:
https://api-3t.sandbox.paypal.com/nvp?SUBJET=N6NXTDH34AVU8&USER=smartsleepmexico-facilitator_api1.gmail.com&PWD=A335BJ4KH2JTXQK6&SIGNATURE=AQvbgS378c0m-4feWi5QGNUGDxvSArRWq5voGjlEE3QpHk-uw-mjrANG&METHOD=SetExpressCheckout&VERSION=204 &PAYMENTREQUEST_0_PAYMENTACTION=SALE&PAYMENTREQUEST_0_AMT=500.00&PAYMENTREQUEST_0_CURRENCYCODE=MXN&L_BILLINGTYPE0=RecurringPayments &L_BILLINGAGREEMENTDESCRIPTION0=Servicios%20Inmoboliarios&NOSHIPPING=1&ALLOWNOTE=0&BRANDNAME=HouseTalk&cancelUrl=https://developer.paypal.com&returnUrl=https://developer.paypal.com
Si la pegas en el Browser funciona OK y regresa el Token para trabajar con PayPal, pero desde el programa GX al ejecutar el GET solo tengo error: "Se ha terminado la conexión: Error inesperado de envío."
Alguien que ya haya realizado esta integración que me oriente.
Saludos,
Hay alguien que haya realizado alguna integración de PayPal para genexus. He estado probando algo que me encontré el la Wiki, sin embargo al probarlo recibo error.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//PayPalSettings.Host = api-3t.sandbox.paypal.com
//PayPalSettings.BaseURL = /
//PayPalSettings.API = nvp
&HTTPClient.Host = PayPalSettings.Host
&HTTPClient.Secure = IIf( PayPalSettings.Secure = !"true", true, false)
&HTTPClient.BaseUrl = PayPalSettings.BaseURL
&Querystring = Format(!"?USER=%1&PWD=%2&SIGNATURE=%3", PayPalSettings.User, PayPalSettings.Password, PayPalSettings.Signature) //Credentials always required
&Querystring += Format(!"&METHOD=SetExpressCheckout&VERSION=%1", PayPalSettings.Version) //Method and API version
&Querystring += Format(!"&PAYMENTREQUEST_0_PAYMENTACTION=SALE&PAYMENTREQUEST_0_AMT=%1&PAYMENTREQUEST_0_CURRENCYCODE=%2", &Parms.Amount, PayPalSettings.CurrencyCode ) //Set a sale, the amount and currency code
&Querystring += Format(!"&L_BILLINGTYPE0=RecurringPayments&L_BILLINGAGREEMENTDESCRIPTION0=%1&NOSHIPPING=1&ALLOWNOTE=0", &Parms.ProductDescription) //Set a Recurring Payments, the description for the agreement and ser no data for shipping and not allow any notes
&Querystring += Format(!"&BRANDNAME=%1", PayPalSettings.BrandName) //Set the brandname or product name
If &Parms.cancelURL.IsEmpty() //Set the cancel URL to return when the user cancel the agreement in Paypal
&Querystring += Format(!"&cancelUrl=%1", PayPalSettings.CancelURL)
Else
&Querystring += Format(!"&cancelUrl=%1", &Parms.cancelURL)
Endif
If &Parms.returnURL.IsEmpty() //Set the URL to return after the user authorize the recurring payments.
&Querystring += Format(!"&returnUrl=%1", PayPalSettings.ReturnURL )
Else
&Querystring += Format(!"&returnUrl=%1", &Parms.returnURL)
Endif
&HTTPClient.Host += PayPalSettings.BaseURL + PayPalSettings.API + &Querystring.Trim()
&HttpClient.Execute('GET','')
&Response = &HTTPClient.ToString()
If StrSearch(&Response, !"ACK=Success", 1) > 0
//Get Token returned by Paypal
&StartPosition = StrSearch(&Response, !"TOKEN=", 1)
&StartPosition += 6
&EndPosition = StrSearch(&Response, !"&", &StartPosition)
&Length = &EndPosition - &StartPosition
&Token = &Response.Substring(&StartPosition, &Length )
&isOK = true
Else
&isOK = false
Endif
La cadena de consulta queda algo asi:
https://api-3t.sandbox.paypal.com/nvp?SUBJET=N6NXTDH34AVU8&USER=smartsleepmexico-facilitator_api1.gmail.com&PWD=A335BJ4KH2JTXQK6&SIGNATURE=AQvbgS378c0m-4feWi5QGNUGDxvSArRWq5voGjlEE3QpHk-uw-mjrANG&METHOD=SetExpressCheckout&VERSION=204 &PAYMENTREQUEST_0_PAYMENTACTION=SALE&PAYMENTREQUEST_0_AMT=500.00&PAYMENTREQUEST_0_CURRENCYCODE=MXN&L_BILLINGTYPE0=RecurringPayments &L_BILLINGAGREEMENTDESCRIPTION0=Servicios%20Inmoboliarios&NOSHIPPING=1&ALLOWNOTE=0&BRANDNAME=HouseTalk&cancelUrl=https://developer.paypal.com&returnUrl=https://developer.paypal.com
Si la pegas en el Browser funciona OK y regresa el Token para trabajar con PayPal, pero desde el programa GX al ejecutar el GET solo tengo error: "Se ha terminado la conexión: Error inesperado de envío."
Alguien que ya haya realizado esta integración que me oriente.
Saludos,
Valora esta pregunta
0