def test_with_feesPayer_SENDER(self): fees_payer = 'SENDER' #A # fees_payer = 'EACHRECEIVER' #B receiver_email = '*****@*****.**' #C # receiver_email = '*****@*****.**' #D # receiver_email = '*****@*****.**' #E 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 = [{'amount': '10.00', 'email': receiver_email}] receivers = [{ 'amount': '10.00', 'email': '*****@*****.**' }, { 'amount': '10.00', 'email': '*****@*****.**' }] response = paypal.pay( actionType='PAY', cancelUrl=settings.PAYPAL_CANCEL_URL, currencyCode='USD', # senderEmail = '*****@*****.**', #no need to set this feesPayer=fees_payer, receiverList={'receiver': receivers}, returnUrl=settings.PAYPAL_RETURN_URL, ipnNotificationUrl=settings.PAYPAL_IPNNOTIFY_URL) paykey = response['payKey'] self.assertTrue(paykey is not None)
def setUp(self): self.paypal = AdaptivePayments(API_USERNAME, API_PASSWORD, API_SIGNATURE, API_APPLICATION_ID, API_EMAIL, sandbox=True) self.paypal.debug = False
def __init__(self, *args, **kwargs): self.payments = AdaptivePayments(settings.PAYPAL_API_USERNAME, settings.PAYPAL_API_PASSWORD, settings.PAYPAL_API_SIGNATURE, settings.PAYPAL_API_APPLICATION_ID, settings.PAYPAL_API_EMAIL, sandbox=settings.USE_PAYPAL_SANDBOX) super(AdaptivePapalPayments, self).__init__()
def get_paypal(self, project_id): paypal = AdaptivePayments( config[project_id].PAYPAL_USER_ID, config[project_id].PAYPAL_PASSWORD, config[project_id].PAYPAL_SIGNATURE, config[project_id].PAYPAL_APPLICATION_ID, config[project_id].PAYPAL_RECEIVER_EMAIL, config[project_id].PAYPAL_SANDBOX) paypal.debug = False return paypal
from django.conf import settings from paypalx import AdaptivePayments from urllib import urlencode from urllib2 import urlopen, Request import logging logger = logging.getLogger(__name__) 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) paypal.debug = settings.PAYPAL_DEBUG if (settings.PAYPAL_USE_SANDBOX): WEBSCR_URL = 'https://www.sandbox.paypal.com/cgi-bin/webscr' else: WEBSCR_URL = 'https://www.paypal.com/cgi-bin/webscr' def generate_paypal_payment(payment): receivers = [] for part in payment.getParts(): receivers.append({ 'amount': str(part.realprice), 'email': part.programmer.email }) receivers.append({ 'amount': "%.2f" % payment.fee,