Skip to content

Instantly share code, notes, and snippets.

@tonylampada
Created December 15, 2012 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonylampada/4298454 to your computer and use it in GitHub Desktop.
Save tonylampada/4298454 to your computer and use it in GitHub Desktop.
Paypal in portuguese
from django.conf import settings
from paypalx import AdaptivePayments
from urllib import urlencode
from urllib2 import urlopen, Request
import logging
paypal = AdaptivePayments(settings.PAYPAL_API_USERNAME,
settings.PAYPAL_API_PASSWORD,
settings.PAYPAL_API_SIGNATURE,
settings.PAYPAL_API_APPLICATION_ID,
settings.PAYPAL_API_EMAIL,
sandbox=settings.PAYPAL_USE_SANDBOX)
receivers = []
receivers.append({'amount' : '10.00', 'email' : 'penepoleb@gmail.com'})
response = paypal.pay(
actionType = 'PAY',
cancelUrl = settings.PAYPAL_CANCEL_URL,
currencyCode = 'USD',
feesPayer = 'EACHRECEIVER',
receiverList = { 'receiver': receivers},
returnUrl = settings.PAYPAL_RETURN_URL,
ipnNotificationUrl = settings.PAYPAL_IPNNOTIFY_URL,
errorLanguage = "en_US"
)
paykey = response['payKey']
print('https://www.paypal.com/webapps/adaptivepayment/flow/pay?paykey=%s&expType=light&country.x=us&locale=en_US&change_locale=1' % paykey)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment