I would like to display all the inbound/outbound transactions a user made/received to display it in a simple html list.
I'm using the recommended node.js module https://github.com/paypal/rest-api-sdk-nodejs and I'm trying to use this code to get the transactions:
// Get Transaction History
paypal.payment.list({
'count': 100,
'sort_by':'create_time',
'sort_order': 'asc',
'start_time': '2008-03-06T11:00:00Z'
}, function(error, payment_history){
if(error){
console.error('error', error);
response.data.payment_history = {};
} else {
console.log('history', payment_history);
response.data.payment_history = payment_history;
}
response.finish();
});
but payment_history gives me { count: 0 }. I'm pretty sure that I have transactions since 2008.
I'm not really sure what's the problem. The user is already logged in using the access_token and I can display user informations but I have no idea how to pull transaction informations.
Look into https://developer.paypal.com/docs/faq/#general-developer-questions for the answer to "Can I retrieve the history of transactions created using the Classic APIs using the REST API?".
I also ran into this issue. Strangely, It seems that the PayPal REST API only returns results for payments made through the REST API. See here: https://stackoverflow.com/a/18139747
Classic API will remain the way to do this until the REST API is improved.
Related
is there an api on shopify where I can see real time when data changes ? Maybe I have a node server and I use sockets to see when anyone has bought anything from my shop that I get a notification via nodejs on my backend. is it possible ? a few websites has this, they offers you to sell on their site and you can see real time changes data when anything was bought
Yes, you can subscribe to multiple Webhooks to get notified when a change occurs on your shop. Using the REST Admin API, available webhook event topics include:
orders/create: occurs whenever an order is created / someone buys from your shop.
orders/paid: occurs whenever an order is paid.
orders/fulfilled: occurs whenever an order is fulfilled.
orders/cancelled: occurs whenever an order is cancelled.
Use the /admin/api/2023-01/webhooks.json endpoint to subscribe to a webhook:
// Node.js - Session is built by the OAuth process
const webhook = new shopify.rest.Webhook({session: session});
webhook.topic = "orders/create";
webhook.address = "https://example.hostname.com/";
// format you want to receive the event data in
webhook.format = "json"; // or XML
// fields you want to receive
webhook.fields = [
"id",
"note"
];
await webhook.save({
update: true,
});
You can also use the GraphQL Admin API for the same purpose.
I am trying to setup paytm in my Flutter app, I create the txn token on firebase cloud function in which the callback URL I pass it is paytm's static url, https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=order_id. While the payment flow is working on the client side, I'm not sure how do I get back the response of the payment ON MY BACKEND once the transaction is complete (succeeded or failed)? Do I set up a polling just after I create the transaction token to call the order status API? I tried setting up a webhook in the dashboard > Developer > Webhooks > payment notification, but no requests are made from the paytm servers after the transaction (same goes for refund webhooks).
There is a one plugin available for doing this called paytmkaro you can use this but it's only work with production keys.
Before starting upload the server side code on server which is available on their documentation which is available here please don't make any changes on server side code it's used to generate a txn token on paytm server.
Change the minimum sdk version to 19
and just copy paste this code
` try {
PaytmResponse paymentResponse = await _paytmKaro.startTransaction(
url: serverside code url e.g. https://arcane-temple-61754.herokuapp.com/intiateTansection.php,
mid: your Production merchant id,
mkey: your merchant key,
customerId:customer id (must be unique for every customer),
amount: transection amount,
orderId: Order Id (Order id must be unique Everytime for every order),
);
if(paymentResponse.status=="TXN_SUCCESS"){
Navigator.push(context, MaterialPageRoute(builder: (context)=>txnSuccessful(paytmResponse: paymentResponse,)));
}
else if(paymentResponse.status=="TXN_FAILURE"){
Navigator.push(context, MaterialPageRoute(builder: (context)=>txnFailed(paytmResponse: paymentResponse,)));
}
}
catch(e){
print(e);
key.currentState.showSnackBar(SnackBar(content: Text(e.toString()))); // platformVersion = 'Failed to get platform version.'
}`
and you are done.
Please raise a query to paytm -> Open paytm developer portal than go into the FAQ section and click on send a Query.
I am currently working on a project that creates Discount Codes via API and I need to retrieve which orders have used a specified Discount Code (ex: TESTCODE123). I couldn't find the documentation or API endpoint mentioned in the Shopify API pages. Is it possible to guide me on this?
You will need to use Admin GraphQL for this and rely on the query parameter to filter them out.
Example:
{
orders(first: 10, query:"discount_code:TESTCODE123"){
edges {
node {
id
}
}
}
}
You can refer the docs here: https://shopify.dev/docs/admin-api/graphql/reference/queryroot?api[version]=2020-01
I am using project-oxford inorder to use Microsoft API with nodejs. I am keep on getting error that ,
{"code":"Unspecified","message":"Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key."}
{"code":"Unspecified","message":"Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key."}
I have also regenerated my subscription key for my microsoft account and tried to access the code. Still I am getting the same issue. Spent lot of time to find my bug fixed, But I couldn't able to solve.
This is my nodejs code,
var oxford = require('project-oxford'),
client = new oxford.Client({SubscriptionKey});
client.video.trackFace({
url: path,
}).then(function (response) {
console.log('Response ' + JSON.stringify(response));
},function (error) {
console.log("Error"+JSON.stringify(error));
});
Please guide me to fix this issue.Thanks in Advance!!
You can obtain a key via the Microsoft Cognitive Services web site.
From what I can gather, you are using https://github.com/felixrieseberg/project-oxford, is that correct?
It seems that project requires one subscription key, which then is used for all API calls. I can't see any reasons it shouldn't work, if you have signed up for the subscription key for the Video API.
Given that the library you're using is built the way it is, it seems to me that you will only be able to use one API at the time, doing it the way you're doing it now.
Am I making any sense?
Actually Now I am getting output for the same code excepting that I was not able use the localhost URL [i.e., http://localhost:3000/uploads/img.jpg]. While using the url of webserver only then I am getting the output!!
Can anyone explain me the complete fact. i.e., I need to know whether I cannot use the localhost url. If I use so I am getting the error which I have posted in this question.
I'm using Create PayPal SDK to make a transaction using paypal and redirecting the user to paypal.
I'm using the same code as per suggested in above link, but i want to send invoice number with create paypal to be shown under transaction detail. but i am not able to find how can i send a invoice number to paypal.
Please guide me if there is any object in which i can sent the invoice number to Create PayPal SDK OR any other method through which i can sent invoice number to PayPal.
Note: this project is in sailsjs.
Thanks
Please check this: https://github.com/paypal/PayPal-node-SDK/blob/master/samples/invoice/send.js
var invoiceId = "INV2-GLJ8-9FA2-26BB-GHLU";
paypal.invoice.send(invoiceId, function (error, rv) {
if (error) {
console.log(error.response);
throw error;
} else {
console.log("Send Invoice Response");
console.log(rv);
}
});
Please look at the complete invoice example here, there is everything you need: https://github.com/paypal/PayPal-node-SDK/tree/master/samples/invoice
As per documentation you can handle your custom IDs:
For exploring additional payment capabilites, such as handling
discounts, insurance, soft_descriptor and invoice_number, have a look
at this example. These bring REST payment functionality closer to
parity with older Merchant APIs. https://github.com/paypal/PayPal-node-SDK