Gábor Plesz
Gábor Plesz

Reputation: 1223

Managing international users

There are three major problems with the collection of payments:

Our company deals with Hungarian products, including the product description of accented characters are. The new RestAPI can successfully manage the payments to resolve the first round, but I can not accented characters to pass the paypal server.

If HTML.Encoding I'm using, the cipher text will be displayed on the checkout page does not decode the Paypal server. (Environment: Windows, .NET, C#)

So:

1. How do I use accented characters with the name of items?

Update:

I tried UTF8 as follows:

1.1. get the access token:

curl https://api.sandbox.paypal.com/v1/oauth2/token \
 -H "Accept: application/json" \
 -H "Content-Type: charset=UTF-8" \
 -H "Accept-Language: hu_HU" \
 -u "EOJ2S-Z6OoN_le_KS1d75wsZ6y0SFdVsY9183IvxFyZp:EClusMEUk8e9ihI7ZdVLF5cZ6y0SFdVsY9183IvxFyZp" \
 -d "grant_type=client_credentials"

1.2. answer:

{"scope":"openid https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card/.* https://api.paypal.com/v1/vault/credit-card 

https://api.paypal.com/v1/developer/.*",
"access_token":"5tz416Qgym8Si9RM0nBS4DNSrGRFCMu5vZ923s--hLM",
"token_type":"Bearer",
"app_id":"APP-8KK24973T6066201W",
"expires_in":28800
}

1.3. The content json (I saved as UTF-8 text file with notepad with name 'content-utf8.json')

{
  "intent":"sale",
  "redirect_urls":{
    "return_url":"http://example.com/your_redirect_url/",
    "cancel_url":"http://example.com/your_cancel_url/"
  },
  "payer":{
    "payment_method":"paypal"
  },
  "transactions":[
    {
      "amount":{
        "total":"7.47",
        "currency":"USD"
      },
      "description":**"Árvíztűrő tükörfúrógépes tanfolyam"**
    }
  ]
}

1.4. Send the payment

curl -v https://api.sandbox.paypal.com/v1/payments/payment \
-H 'Content-Type:application/json; charset=utf-8' \
-H 'Authorization:Bearer 5tz416Qgym8Si9RM0nBS4DNSrGRFCMu5vZ923s--hLM' \
--data 'content-utf8.json'

1.5. The answer

* Adding handle: conn: 0x1385f58
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1385f58) send_pipe: 1, recv_pipe: 0
* About to connect() to api.sandbox.paypal.com port 443 (#0)
*   Trying 23.42.27.39...
* Connected to api.sandbox.paypal.com (23.42.27.39) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: C:\Program Files\Git\bin\curl-ca-bundle.crt
  CApath: none
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Request CERT (13):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using RC4-SHA
* Server certificate:
*        subject: C=US; ST=CALIFORNIA; L=San Jose; O=PayPal, Inc.; OU=Partner Su
pport; CN=api.sandbox.paypal.com
*        start date: 2013-08-20 00:00:00 GMT
*        expire date: 2015-08-21 23:59:59 GMT
*        subjectAltName: api.sandbox.paypal.com matched
*        issuer: C=US; O=VeriSign, Inc.; OU=VeriSign Trust Network; OU=Terms of
use at https://www.verisign.com/rpa (c)10; CN=VeriSign Class 3 Secure Server CA
- G3
*        SSL certificate verify ok.
> POST /v1/payments/payment HTTP/1.1
> User-Agent: curl/7.30.0
> Host: api.sandbox.paypal.com
> Accept: */*
> Content-Type:application/json; charset=utf-8
> Authorization:Bearer 5tz416Qgym8Si9RM0nBS4DNSrGRFCMu5vZ923s--hLM
> Content-Length: 12
>
* upload completely sent off: 12 out of 12 bytes
< HTTP/1.1 400 Bad Request
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< PayPal-Debug-Id: eb749926be259
< Content-Type: application/json;charset=UTF-8
< Content-Length: 200
< DC: origin2-api.sandbox.paypal.com
< Date: Tue, 15 Oct 2013 09:03:52 GMT
< Connection: close
< Set-Cookie: DC=origin2-api.sandbox.paypal.com; secure
<
{"name":"MALFORMED_REQUEST",
"message":"The request JSON is not well formed.",
"information_link":"https://developer.paypal.com/webapps/developer/docs/api/#MALFORMED_REQUEST",
"debug_id":"eb749926be259"}
* Closing connection 0
* SSLv3, TLS alert, Client hello (1):

The bottom line: **MALFORMED_REQUEST: The request JSON is not well formed.**

+++

We plan to our customers from different countries, so it would be nice if paying by PayPal page (if supported by the language) would be displayed in their language.

2. How do I solve it as returned by Paypal approval_url page displayed in English/Hungarian (or any other language supported by paypal)?

When paying customers redirected to the PayPal site where you can pay with credit card, you should fill in a few fields (firstname, lastname, address, phone, etc). Tulum would be nice if we could retrieve these fields forward data.

+++

3. How do I get through the PayPal RestAPI (or otherwise) to send client data to the server before the PayPal payment?

Any help is appreciated!

Upvotes: 0

Views: 306

Answers (1)

Machavity
Machavity

Reputation: 31624

Paypal accepts only UTF-8. I've not tried Hungarian languages, but UTF-8 will cover that. Make sure all your calls are encoded that way and they should go through.

Paypal will likely show them pages in the closest language to them. I don't see Hungarian explicitly listed in in the LOCALECODEs listed on this page. Sorry I can't be of more help here.

As to how to send data to Paypal, I find CURL works really well for this.

Upvotes: 1

Related Questions