jerrygeorge360 / flaskpaypallib

This easy to use library ensures seamless integration of the paypal sdk into the flask framework.
https://pypi.org/project/flaskpaypallib/0.0.2/
MIT License
3 stars 2 forks source link

Capture transaction data #4

Open EnriqueGautoSand opened 1 year ago

EnriqueGautoSand commented 1 year ago

i want to capture the transaction data when the user finish the payment

    def complete_process(self):
        """
        this completes the transaction by either capturing or authorizing the payment
        registers an endpoint that would be redirected after approval.
        Parameters
        ----------
        """
        with self.app.app_context():
            @current_app.route(f'/{self.return_url_endpoint}')
            def complete_process():
                res=''
                if self.intent=="CAPTURE":
                    res=self._capture()
                elif self.intent=="AUTHORIZE":
                    res=self._authorize()
                else:
                    res='not successful'
                return res  #<--- You are showing the data

So is there a way to get that data? and bind it with the user? for give to the user more roles after payment

or i need to overwrite the class?

Payer = Sandbox('USD', 10, 'shirts', 6, 'nice shirts', 10, 20, 2, 3, 7, 2, 'CAPTURE', 'http://localhost:8080/okme',
                'okme', 'http://localhost:8080/')
Payer.init_app(app)

Payer.generate_access_token(client_id, client_secret_key)

Payer.create_order_route('shirts')

Payer.complete_process()

@app.route("/")
def home():
    return render_template("pago/paypal.html")
@app.route("/okme")
def okme():
    if request.method == 'GET':
        print("GET")
        print(request.data)
    if request.method == 'POST':
        print("POST")
        print(request.get_json())

if __name__ == '__main__':
    app.run(debug=False,host="localhost",port="8080")
jerrygeorge360 commented 1 year ago

Inside the complete_process method , it returns the transaction data to the browser, I haven't written any code to capture the data yet to bind it to the user. The project is still in development , thanks for your involvement.

On Wed, Jan 18, 2023, 7:22 PM EnriqueGautoSand @.***> wrote:

i wanna to capture the transaction data when finishes the payment

def complete_process(self):
    """
    this completes the transaction by either capturing or authorizing the payment
    registers an endpoint that would be redirected after approval.
    Parameters
    ----------
    """
    with self.app.app_context():
        @current_app.route(f'/{self.return_url_endpoint}')
        def complete_process():
            res=''
            if self.intent=="CAPTURE":
                res=self._capture()
            elif self.intent=="AUTHORIZE":
                res=self._authorize()
            else:
                res='not successful'
            return res  #<--- You are showing the data

So is there a way to get that data? and bind it with the user? for give to the user more roles after payment

or i need to overwrite the class?

Payer = Sandbox('USD', 10, 'shirts', 6, 'nice shirts', 10, 20, 2, 3, 7, 2, 'CAPTURE', 'http://localhost:8080/okme', 'okme', 'http://localhost:8080/') Payer.init_app(app)

Payer.generate_access_token(client_id, client_secret_key)

Payer.create_order_route('shirts')

Payer.complete_process()

@app.route("/") def home(): return render_template("pago/paypal.html") @app.route("/okme") def okme(): if request.method == 'GET': print("GET") print(request.data) if request.method == 'POST': print("POST") print(request.get_json())

if name == 'main': app.run(debug=False,host="localhost",port="8080")

— Reply to this email directly, view it on GitHub https://github.com/jerrygeorge360/flaskpaypallib/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/AU7VY2FICJJCUK4GNFONZDDWTAYGRANCNFSM6AAAAAAT7M5ZU4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>