33
Views
15
Comments
Order data from Webhook to specific user


Hello community!

I'm new here, just a couple of months since I started learning this platform. Thanks to the forum and your advice, I was able to solve a number of difficult questions for me. I am very grateful to your.

Today I have a new problem! =) I will be glad to any advice!


Task:

1 Send payment data via WEBHOOK. (DONE) although I don't speak Portuguese, but the video of this guy @leoandradenet from YouTube  helped me a lot.

2 synchronize this data with the buyer.

At this stage, I can match the email and phone number, thereby finding out which user the payment belongs to. (an easy solution would be to use the processing company's RES API, but I can't use it yet)


How can I assign a payment to a customer?



2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

If that's your entire data model, it seems to me you need a Payment entity?

UserImage.jpg
Anton Polyakov

Hello Kilian,

I understand in general what you mean, but I'm not sure, can you give an example?

I have no experience, so most likely I just don't know what you're talking about.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

You have a PaymentNumber and PaymentDate in your Order, but I would instead add a Payment Entity, containing an OrderId, PaymentNumber and PaymentDate, and create a Payment record when the payment is received.

UserImage.jpg
Anton Polyakov

Unfortunately, I made a mistake when I did the example.

I changed the screen in the post

2021-09-06 15-09-53
Dorine Boudry
 
MVP

You should be concerned with linking it to an order, rather than a buyer, you probably would like some repeat business, so hopefully same customer does many payments.

How to do it, we can't answer that for you, here's some questions only you know :

  • these payments don't come out of thin air, i assume.  Where do they originate ?  Is your system sending a payment request to some service ?  Of so, surely that service allows you to send some identifiying information that will be sent back to your webhook.
  • at the point of originating, they are caused because of an outstanding amount to be paid, right ?
  • that outstanding amount matches to one or more orders in your system ?
  • Elaborating on Kilian's advice, I would probably have an electronic payment entity in my datamodel, containing the service used, identifying information sent, time sent, amount sent, ... , create a pending record at time of requesting for payment to 3rd party and in the webhook go and find the payment, update status to it being or not being successfull, time the answer came back, etc. and then if succesfull, relate back to the order(s) the request was for to update them to paid and relate them to the payment that took care of it


P.S. I'm going to let the remark about datamodels not being important slide, on account of you being a beginner ;-)

UserImage.jpg
Anton Polyakov

Hello Dorine,

Everything is very simple.

I have a one-time product (video course). After payment, access to the video opens. I cannot sell the same video course twice to the same client.

The client clicks on the button in the application and goes to the website of the processing company, where he makes the payment.

After a successful payment, I receive payment data via Webhook.

P.S As you rightly pointed out, I'm a beginner, it's very embarrassing to understand that even I'm asking the wrong question, thank you!

UserImage.jpg
Anton Polyakov


One course = one payment

The client cannot select several courses and pay for them at the same time

In the future, of course, I will try to implement this, but now such a task is not worth it.

I understand that my knowledge is not enough to implement it. Perhaps with the transition to the RES API in the future I will try to implement this

2021-09-06 15-09-53
Dorine Boudry
 
MVP

So then,

At the point where your client 'goes to the website of the processing company' your software is sending details to that service, right ?  So you can create a payment record linked to the customer/course, generate a uuid as one of the attributes, send the uuid to that service, receive the same uuid back on the webhook.

So in the webhook logic you can use that uuid to find the customer/course the payment is for.

UserImage.jpg
Anton Polyakov

No Dorine, my software dont send details to the server. 

If the software was sent data, I would have no problem getting this data back.

The maximum that I can do at this stage is to match the email and phone, thereby determining the sender.

I understand that this may not seem like a serious approach to you, but unfortunately I cannot yet use the entire REST API cycle of my processing company. 

This is the problem I need to solve.

Determine the buyer according to the data received from the Webhook.

At this stage, I don't need more.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

aah, ok, 

I don't really see what type of help we can give you then, this is a functional question, not a technical one : how to match (incomplete or incorrect) information coming in with existing information in your database.  

How do you even know if they used the same email when doing the payment ?

In that case, you can try to match, but you'll need a human trying to match manually if system can't.  

Maybe if a payment comes in that doesn't match any orders, mail that email address in the payment with a request to reply with more information about who in your systems they are supposed to be / what order that payment was for ...

2021-09-06 15-09-53
Dorine Boudry
 
MVP

although I'm still not really getting how that payment comes into existence then, and how that service knows it needs to use that webhook of yours, I mean, how does that payment service even know how much money to charge ???

UserImage.jpg
Anton Polyakov


A landing page is created on the processing side, in the landing page settings, I specify a webhook by which processing sends payment data. The client fills in the mail and phone number, pays a fixed amount by credit card or other mobile app. 

Usually I used MAKE to automate the process, after paying for the order, the client received a link to the course page by email/whatup/telegram/chatbot

I'm trying to make an android/iPhone app and want to opt out of the website, automation in MAKE, and other...

2020-02-28 09-46-54
Eduardo Jauch

Hello Anton,

"How can I assign a payment to a customer?" is a really "broad" question.

Could you explain what it means? What you are trying to achieve? What are you asking, really?
I mean, From the datam model you show here, I don't know what you want to do. 

For a start, the relationship between the User, Products and Order does not seem correct.
The way it is now, a product can be assigned to a single Order and to a single User. If another user wants that product, and you assign it to the user and the new product, you will lose the information about the previous User/Order.

So, I have to ask: is your problem with your data model?
I mean, are you asking how to create the data model to allow you to keep information?

If so: 

1. Create a new entity, OrderProduct, add OrderId and ProductId to it, Price and Quantity (maybe). It creates a many to many relationship between product and order, that it is what makes sense to me?

2. Remove UserId and OrderId from Products

3. Add UserId (your customer?) to Order. (one to many relationship)


Now products is just a list of products with the actual price. Order contains the information about the user (your customer) and OrderProducts keeps the iformation about the products for a specific order, and the price at the time of the order.

Does this help?


UserImage.jpg
Anton Polyakov

Hello Eduardo,

Unfortunately, I made a mistake when I did the example.

I have it all done like this


UserImage.jpg
Anton Polyakov

I receive payment data via Webhook, how can this data be associated with the user?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.