2010-04-26 18 views
10

मैं पायथन (Django का उपयोग करके) में एक वेबसाइट तैयार कर रहा हूं, और मुझे इसके माध्यम से चीजें बेचने की ज़रूरत है।डीजेगो और पेपैल एकीकरण

क्या कोई मुझे पेपैल-प्रो (प्रत्यक्ष-भुगतान भुगतान) या अन्य पेपैल-मानक (एक्सप्रेस चेकआउट) को एकीकृत करने के लिए स्रोत कोड के साथ मेरी सहायता कर सकता है?

उत्तर

3

क्या आपने pypaypal पर देखा था? आप एक ऐसा दृश्य बना सकते हैं जो पेपैल से जुड़ता है और आपके भुगतान आदेश सबमिट करता है।

16

आप django-paypal को आजमा सकते हैं, यहां पर tutorial भी सामने वाले पृष्ठ पर है।

+7

आप साहब, एक संत ... +1 सेवा आप सवाल :) – Jiaaro

+0

मैं कर सकता हूँ संपादन में समुदाय किया है के लिए कर रहे हैं वहां ट्यूटोरियल नहीं देखें :( –

+1

मैंने ट्यूटोरियल –

0

बेहतर मालिक से उपयोग करने के लिए "मूल" डॉक्स होगा: docs paypal

0

पेपैल मानक IPN सुरक्षित लेन-देन, रिसीवर पेपैल खाते को प्रत्यक्ष भुगतान

paypal.standard.ipn

पेपैल एपीआई एक बटन जेनरेट करता है जो paypal.standard.ipn के माध्यम से अपना एपीआई कॉल करेगा।

API एकीकरण के लिए आप नीचे दिए गए चरणों का पालन करना -

1. Install django-paypal: 

    pip install django-paypal 

2. Update settings.py file: 

    INSTALLED_APPS = [ 
     'paypal.standard.ipn', 
    ] 

Add: 

    PAYPAL_RECEIVER_EMAIL = 'XXXXX' 
    PAYPAL_TEST = True 

Note: 
Write Email address of Receiver. 
“PAYPAL_TEST = True” means you want an Test API payment. You can write "False" for Original payment API. 

3. Run command: 

    python manage.py migrate 

4. Now come to source code: 

In url.py: 

    url(r'^paypal/', include('paypal.standard.ipn.urls')), 
    url(r'^payment_process/$', api_views.payment_process, name='payment_process'), 

    url(r'^payment_done/$', TemplateView.as_view(template_name= "pets/payment_done.html"), name='payment_done'), 

    url(r'^payment_canceled/$', TemplateView.as_view(template_name= "pets/payment_canceled.html"), name='payment_canceled'),* 

In views.py: 

    from django.conf import settings 
    from django.urls import reverse 
    from django.shortcuts import render, get_object_or_404 
    from paypal.standard.forms import PayPalPaymentsForm 

    def payment_process(request): 
     host = request.get_host() 
     paypal_dict = { 
     'business': settings.PAYPAL_RECEIVER_EMAIL , 
     'amount': ‘100’, 
     'item_name': 'Item_Name_xyz', 
     'invoice': ' Test Payment Invoice’, 
     'currency_code': 'USD', 
     'notify_url': 'http://{}{}'.format(host, reverse('paypal-ipn')), 
     'return_url': 'http://{}{}'.format(host, reverse('payment_done')), 
     'cancel_return': 'http://{}{}'.format(host, reverse('payment_canceled')), 
     } 
    form = PayPalPaymentsForm(initial=paypal_dict) 
    return render(request, 'pets/payment_process.html', {'form': form })* 

Note: Follow video tutorial for django-code given in reference. 

In payment_process.html: 

    {{ form.render }} 


For calling API you have request for /payment_process/. It will generate a button on HTML which calls PayPal API for transaction. Further process will be done on PayPal end, Login or Card Payment.**  

Reference: 
(a) [https://django-paypal.readthedocs.io/en/stable/][1] 
(b) [https://www.youtube.com/watch?v=Z5dBopZWOzo&t=417s][1] 
संबंधित मुद्दे