I've got a webform, sending data (and the customer) to PayPal.
My JSON request:
{
"intent":"sale",
"payer":{
"payment_method":"paypal"
},
"redirect_urls":{
"return_url":"http://dev1.url.de/payment/execute?method=paypal&price=1&order_number=123465&success=true",
"cancel_url":"http://dev1.url.de/payment/execute?method=paypal&price=1&order_number=123465&success=false"
},
"transactions":[
{
"amount":{
"currency":"EUR",
"total":"1"
},
"item_list":{
"items":[
{
"name":"123465",
"currency":"EUR",
"quantity":1,
"price":"1"
}
]
},
"invoice_number":"123465"
}
]
}
and a PayPal response:
{
"id":"PAY-0YV50781X7702245FKVDWC5A",
"create_time":"2015-05-04T12:09:24Z",
"update_time":"2015-05-04T12:09:24Z",
"state":"created",
"intent":"sale",
"payer":{
"payment_method":"paypal",
"payer_info":{
"shipping_address":{
}
}
},
"transactions":[
{
"amount":{
"total":"1.00",
"currency":"EUR",
"details":{
"subtotal":"1.00"
}
},
"invoice_number":"123465",
"item_list":{
"items":[
{
"name":"123465",
"price":"1.00",
"currency":"EUR",
"quantity":"1"
}
]
},
"related_resources":[
]
}
],
"links":[
{
"href":"https://api.paypal.com/v1/payments/payment/PAY-0YV70781X7192245FKVDWC5A",
"rel":"self",
"method":"GET"
},
{
"href":"https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-38Y65870AE087743W",
"rel":"approval_url",
"method":"REDIRECT"
},
{
"href":"https://api.paypal.com/v1/payments/payment/PAY-0YV50781X7170245FKVDWC5A/execute",
"rel":"execute",
"method":"POST"
}
]
}
And going through the payment process on the PayPal website seems all to be fine.
I can login, I can see all correct details and after I click on send payment, it redirects me to my form (return_url) and it says I paid.
The thing is .. it's not paid.
I can't see the money sent and it never arrives - not transaction is triggered. How can I figure out the problem? Or does anybody have a clue?
Related
How do I post this Paypal response details to database
I have succefully made payment using smart button paypal.
I am able to capture the response details using console log.
Now How do I post the response array to database using laravel.
Onapproval
onApprove: function(data, actions) {
let token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
// This function captures the funds from the transaction.
return actions.order.capture().then(function(details) {
if(details.status == 'COMPLETED'){
return fetch('/pages/save', {
method: 'post',
headers: {
'content-type': 'application/json',
"Accept": "application/json, text-plain, */*",
"X-Requested-With": "XMLHttpRequest",
"X-CSRF-TOKEN": token
},
body: JSON.stringify({
orderId : data.orderID,
id : details.id,
status: details.status,
payerEmail: details.payer.email_address,
})
})
.then(status)
.then(function(response){
// redirect to the completed page if paid
console.log(details)
// window.location.href = '/pages/sucess';
})
.catch(function(error) {
// redirect to failed page if internal error occurs
window.location.href = '/pages/fail?reason=internalFailure';
});
}else{
window.location.href = '/pages/fail?reason=failedToCapture';
}
});
},
Laravel route
Route::get('pages/sucess', [App\Http\Controllers\OrderController::class, 'sucess'])->name('pages.sucess');
Output
{
"id": "9S369747UW261581G",
"intent": "CAPTURE",
"status": "COMPLETED",
"purchase_units": [
{
"reference_id": "default",
"amount": {
"currency_code": "USD",
"value": "0.50"
},
"shipping": {
"name": {
"full_name": "John Doe"
},
},
"payments": {
"captures": [
{
"id": "5DS42883V93959154",
"status": "COMPLETED",
"amount": {
"currency_code": "USD",
"value": "0.50"
},
}
]
}
}
],
}
How can one capture PayPal response details and dump the same detail to the Laravel controller so that it can be saved to the database?
Do not use actions.order.create() / .capture() on the client side and then post information to a database.
Instead, change to a proper server-side integration. Make two routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. These routes should return only JSON data (no HTML or text). When a capture response is successful, store its resulting payment details in your database (particularly purchase_units[0].payments.captures[0].id, the PayPal transaction ID) and perform any necessary business logic (such as sending confirmation emails or reserving product) before sending your return JSON.
Pair those two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server
I am able to gent email using https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~)) and able to get name and profile pic using https://api.linkedin.com/v2/me.My question is that how can i get it together.Is there any single API to call and get all profile info together?
The documentation says something about lite and basic profile permissions but unfortunately there doesn't seem to be a way to get both in one query.
Profile Json Response:
{
"firstName":{
"localized":{
"en_US":"Bob"
},
"preferredLocale":{
"country":"US",
"language":"en"
}
},
"localizedFirstName": "Bob",
"headline":{
"localized":{
"en_US":"API Enthusiast at LinkedIn"
},
"preferredLocale":{
"country":"US",
"language":"en"
}
},
"localizedHeadline": "API Enthusiast at LinkedIn",
"vanityName": "bsmith",
"id":"yrZCpj2Z12",
"lastName":{
"localized":{
"en_US":"Smith"
},
"preferredLocale":{
"country":"US",
"language":"en"
}
},
"localizedLastName": "Smith",
"profilePicture": {
"displayImage": "urn:li:digitalmediaAsset:C4D00AAAAbBCDEFGhiJ"
}
}
Contact Json Response:
{
"elements": [
{
"handle": "urn:li:emailAddress:3775708763",
"handle~": {
"emailAddress": "ding_wei_stub#example.com"
},
"primary": true,
"type": "EMAIL"
},
{
"handle": "urn:li:phoneNumber:6146249836070047744",
"handle~": {
"phoneNumber": {
"number": "158****1473"
}
},
"primary": true,
"type": "PHONE"
}
]
}
The reason might be that there are separated APIs, Contact API and Profile API.
ORIGINAL REQUEST: I'm trying to implement the push notifications following the documentation: https://developers.google.com/actions/assistant/updates/notifications
I'm using Dialogflow with webhooks (in PHP) and the documentation is giving example in nodeJS
Right now, i'm blocked because of the Update permission, here's my Webhook response :
{
"source": "webhook",
"payload": {
"google": {
"expectUserResponse": true,
"systemIntent": {
"intent": "actions.intent.PERMISSION",
"data": {
"#type": "type.googleapis.com/google.actions.v2.PermissionValueSpec",
"permissions": [
"UPDATE"
]
},
"updatePermission": {
"intent": "notification.simple.text"
}
}
}
}
}
When I do the simulation, asks me a permission for a push, but not for the intent I specified.
I'm quiet sure that the problem is the updatePermission, something must be wrong with that:
Is it the field name?
In intent, i put the intent name that i filled in dialogflow, maybe do i have to an use action? Is it in the good format ?
If someone can help me or just give me an example of a clean response for an update permission.
Thanks!
Solution
I just found why, my json wasn't good, the updatePermissionValueSpec must be into data object.
{
"source": "webhook",
"payload": {
"google": {
"expectUserResponse": true,
"systemIntent": {
"intent": "actions.intent.PERMISSION",
"data": {
"#type": "type.googleapis.com/google.actions.v2.PermissionValueSpec",
"permissions": [
"UPDATE"
],
"updatePermissionValueSpec": {
"intent": "notification_simple_text"
}
}
}
}
}
}
I believe updatePermission should be named updatePermissionValueSpec.
Example response:
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "PLACEHOLDER"
}
}
]
},
"systemIntent": {
"intent": "actions.intent.PERMISSION",
"data": {
"#type": "type.googleapis.com/google.actions.v2.PermissionValueSpec",
"permissions": [
"UPDATE"
],
"updatePermissionValueSpec": {
"intent": "intent_name"
}
}
}
}
}
When i use this API "https://api.sandbox.paypal.com/v1/payments/payment" for get "approval_url".
It's give error like :
{"name":"VALIDATION_ERROR","details":[{"field":"redirect_urls","issue":"This
field required when payment_method is 'paypal'"}],"message":"Invalid
request
see details
","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"e48112ca1cd19"}
I already mention parameter. This is my array.
{
"intent":"sale",
"experience_profile_id":"XP-AAAA-AAAA-AAAA-AAAA",
"payer":{
"payment_method":"paypal"
},
"transactions":[
{
"amount":{
"total":"9.00",
"currency":"EUR"
}
}
]
},
"redirect_urls":{
"return_url":"http://example.com/success",
"cancel_url":"http:/example.com/error"
}
Please let me know what is the issue.
Thanks In Advance
I am having problems prefilling textTabs for my server templates in my docusign console. My application generates an agreement on our end and is added as a composite template along with another form that is added as a server template with a template id.
The server template has several fields the user needs to be able to fill out. The tabs have been defined and added with the manage template tool in the docusign console.
I have no problems sending the documents and the signHereTab is the only one that is correctly added to the form.
The two problems I have are 1) the fields the user should fill out are never shown on the recieved document, 2) the prefill information I am sending is not received by docusign. Below is the body request I am sending to the docusign REST API:
{
"emailSubject":"Nexogy Service Agreement Signature Request",
"emailBlurb":"Thank you for your interest in our services. Please sign the following agreement to continue with your service installation.",
"status":"sent",
"emailSettings":{
"replyEmailAddressOverride":"sales#nexogy.com",
"replyEmailNameOverride":"Nexogy",
"bccEmailAddresses":[
]
},
"eventNotification":{
"url":"https:\/\/dna.local.com\/documents\/set-status",
"loggingEnabled":true,
"requireAcknowledgment":true,
"useSoapInterface":false,
"includeDocuments":false,
"includeSenderAccountAsCustomField":true,
"envelopeEvents":[
{
"envelopeEventStatusCode":"Sent"
},
{
"envelopeEventStatusCode":"Delivered"
},
{
"envelopeEventStatusCode":"Signed"
},
{
"envelopeEventStatusCode":"Voided"
},
{
"envelopeEventStatusCode":"Declinded",
"includeDocuments":true
},
{
"envelopeEventStatusCode":"Completed",
"includeDocuments":true
}
]
},
"recipients":{
"signers":[
{
"email":"mmoreno509#gmail.com",
"name":"Test Tester",
"roleName":"Signer1",
"recipientId":718
}
]
},
"compositeTemplates":[
{
"inlineTemplates":[
{
"sequence":1,
"recipients":{
"signers":[
{
"email":"mmoreno509#gmail.com",
"name":"Test Tester",
"roleName":"Signer1",
"recipientId":718,
"tabs":{
"signHereTabs":[
{
"xPosition":100,
"yPosition":205,
"documentId":1,
"pageNumber":6,
"fontColor":"BrightBlue"
}
]
}
}
]
},
"documents":[
{
"documentId":1,
"name":"ChuyMPDFAgreement.pdf",
"remoteUrl":"https:\/\/s3.amazonaws.com\/dna_local\/ChuyMPDFAgreement.pdf"
}
]
}
]
},
{
"serverTemplates":[
{
"sequence":2,
"templateId":"ae435358-1410-40fd-803e-273028d19287",
"recipients":{
"signers":[
{
"email":"mmoreno509#gmail.com",
"name":"Test Tester",
"roleName":"Signer1",
"recipientId":718,
"tabs":{
"textTabs":[
{
"tabLabel":"Full Name",
"value":"Test Tester",
"pageNumber":"1"
},
{
"tabLabel":123123123,
"value":123123123,
"pageNumber":"1"
},
{
"tabLabel":"Address",
"value":"Test",
"pageNumber":"1"
},
{
"tabLabel":"City",
"value":"Hollywood",
"pageNumber":"1"
},
{
"tabLabel":"State",
"value":"FL",
"pageNumber":"1"
},
{
"tabLabel":"ZipCode",
"value":33081,
"pageNumber":"1"
},
{
"tabLabel":"Country",
"value":"US",
"pageNumber":"1"
},
{
"tabLabel":"Phone",
"value":"3454657676",
"pageNumber":"1"
},
{
"tabLabel":"AccountName",
"value":"Testing Company",
"pageNumber":"1"
},
{
"tabLabel":"\\*FullName",
"value":"Test Tester",
"pageNumber":"1"
}
]
}
}
]
}
}
]
},
{
"serverTemplates":[
{
"sequence":3,
"templateId":"017d0d20-754b-4093-8896-ff1c00ee2cda",
"recipients":{
"signers":[
{
"email":"mmoreno509#gmail.com",
"name":"Test Tester",
"roleName":"Signer1",
"recipientId":718,
"tabs":{
"textTabs":[
{
"tabLabel":"AccountName",
"value":"Testing Company",
"pageNumber":"1"
},
{
"tabLabel":123123123,
"value":123123123,
"pageNumber":"2"
}
]
}
}
]
}
}
]
},
{
"serverTemplates":[
{
"sequence":4,
"templateId":"11a88684-07ac-4ee5-9994-cb88635fb42f",
"recipients":{
"signers":[
{
"email":"mmoreno509#gmail.com",
"name":"Test Tester",
"roleName":"Signer1",
"recipientId":718,
"tabs":{
"textTabs":[
{
"tabLabel":"AccountName",
"value":"Testing Company",
"pageNumber":"2"
},
{
"tabLabel":"Address",
"value":"Test",
"pageNumber":"1"
},
{
"tabLabel":"City",
"value":"Hollywood",
"pageNumber":"1"
},
{
"tabLabel":"State",
"value":"FL",
"pageNumber":"1"
},
{
"tabLabel":"ZipCode",
"value":33081,
"pageNumber":"1"
}
]
}
}
]
}
}
]
}
]
}
You can not update template tabs upon creation of the envelope at this time.
Your signHereTabs is in your inlineTemplate, which will add additional tags to your envelope.
If you want to update tabs that are contained in a template via the API, your workflow should look like:
Create Envelope - ("status" : "created")
Modify Envelope - Edit tags here
Send Envelope
All of the documentation around building this workflow is located in DocuSign REST API Guide