How to get Customer object's customerID from metadata in Stripe Payment Intent - api

I am trying to implement stripe payment intent API in golang.
Is there any way I can get customerID from metadata inside of the Customer object?
For example, I create new customer object and insert uuid as metadata. This uuid comes from my database.
// create new customer object
customerParams := &stripe.CustomerParams{
Description: stripe.String("Go Stripe Developer"),
Email: stripe.String("gostripe#stripe.com"),
Phone: stripe.String("1111111111"),
}
customerParams.AddMetadata("uuid", "123")
I do this because in case something happens to my database and customerID is gone, I can retrieve the data such as purchase history from UUID if I can access to metadata inside of the Customer object.
Or at least, I want to set Customer parameter deleted: true, but if there is no customerID record in my database, I cannnot access to the stripe's Customer object since the object can be accessible only from customerID itself according to API docs.
Since I noticed I can insert metadata, if there is some way I can access to Customer object using that metadata, that would save my life.
Any advice is appreciated!

The solution: you can use the List Customers API by email and do an additional filter match with uuid from metadata (in your code), so you can retrieve the customer detail.

Related

xero sdk getInvoices returns empty contact

I am using the xero-node SDK.
I use the getInvoices entry point, and everything works fine meaning that the Invoice data is correct. The Contact JSON object is also returned with the Invoice data (which surprised me) which contains the Contact associated with this invoice.
However, Contact data is blank other than the ContactID and the Contact name. Why would the API return a blank object? This means I have to make an extra call to get the 'real' Contact data. Doesn't make sense.
As it says in the Xero API documentation:
When you retrieve multiple invoices, only a summary of the contact
is returned and no line details are returned - this is to keep the
response more compact.
If you retrieve a single invoice, you'll get more of the contact information.
https://developer.xero.com/documentation/api/accounting/invoices

Getting store id from ebay api

I can get orders of any users using oauth2 via ebay api. When users authorize our app to connect and get his orders , I add a new record including access key and refresh token to my db . But when this user re-authorize our app , a new record which is identical with the previous one is added. How can I get identifier like storeId in ebay api. Store name can be retrieved via GetStore but it can be changed by shop owner, so I think it can not be identifier
Use empty GetUser call.
As mention in Docs:
UserID - Specify the user whose data you want returned by the call. If not specified, eBay returns data pertaining to the requesting user (as specified with the eBayAuthToken value).

Retrieve customer related to payment

Anyone know if it's possible to retrieve the customer name related to a transaction from the API?
I see it under "Paid by" if I follow the "payment_url" in the connect v1 https://connect.squareup.com/v1/{{location_id}}/payments/{{payment_id}} endpoint but can't see to find it anywhere else
Background: I'm working on a ticketing system that breaks out items by item_category so a kitchen gets only food items and the bar gets only drink items.
I have queues and itemized tickets by category BUT I can't seem to find the customer's name anywhere
You'll need to utilize the V2 Transactions API. When you call ListTransactions or RetrieveTransaction (ListTransactions), the Transaction object will have an array of Tenders, tenders, which has a field called customer_id. With this id, you will be able to pass it to RetrieveCustomer (RetrieveCustomer) to find out their name. Note that if you're not explicitly filling out their name, the name might not be available (an "instant profile" (Instant Profiles) will be created with whatever information can be retrieve from the card used to pay).
Update: Alternatively, as suggested by #Dan, would be to strip the payment_url from a V1 RetrievePayment (RetrievePayment) which includes the transaction_id at the end of the URL: https://squareup.com/dashboard/sales/transactions/TRANSACTION_ID. This is more efficient as you won't need to loop through transactions, and allow you to send it straight to RetrieveTransaction.

How to retrieve Square orderIds for Call to BatchRetrieveORders

I want to retrieve a list of orders using the Square API. The call to retrieve orders is a POST call with a String array of order_ids however I'm not sure where I can get this information. In the docs they said I can use the ListTransactions endpoint to get this information but I'm not able to find the order_id within the response.
The documentation to retrieve Orders located at: https://docs.connect.squareup.com/api/connect/v2#endpoint-batchretrieveorders
see sample response of ListTransactions: https://docs.connect.squareup.com/api/connect/v2#endpoint-listtransactions
The Orders API does not support listing of orders. To access order
details, you will need to fetch the order's ID by querying
transactions using the ListTransactions and RetrieveTransaction
endpoints, and then fetching the order using the BatchRetrieveOrders
endpoint
Reference: https://docs.connect.squareup.com/articles/orders-api-overview
The goal is to get a list of recent transactions/orders that list out exactly what was purchased. The Transactions model doesn't contain Items whereas the Orders model does.
The Transaction object will include an order_id field if you included it during the Charge request. If you did not pass the order_id to the Charge request, then it will not show up.
Furthermore - just for clarity's sake, if you use Square Point of Sale, or if you haven't included the order_id previously but still would like to view itemizations for transactions, please look at V1 ListPayments which will include it even if there's no order_id.
References:
https://docs.connect.squareup.com/api/connect/v2#type-transaction
https://docs.connect.squareup.com/api/connect/v1#get-payments

Get transaction by item account id

Hi I am using rest api to access yodlee aggregation services. i am not able to search transaction by item account id. My rest query is as follows
parameters = {
'transactionSearchRequest.searchFilter.itemAcctId'=>itemId,
'cobSessionToken'=>cobSessionToken,
'userSessionToken'=>userSessionToken,
'transactionSearchRequest.containerType'=>con_name,
'transactionSearchRequest.lowerFetchLimit'=>0,
'transactionSearchRequest.resultRange.endNumber'=>500,
'transactionSearchRequest.higherFetchLimit'=>500,
'transactionSearchRequest.resultRange.startNumber'=>1,
'transactionSearchRequest.ignoreUserInput'=>'true',
'transactionSearchRequest.searchFilter.transactionSplitType.splitType'=>"A"
}
The response is always all the transactions for the user instead of transactions for a particular item account id.
Any help is appreciated
You are passing ItemId but the parameter passed should be ItemAccoutnId.
Difference between ItemId and ItemAccountId -
when you link a site say "Citibank" then an itemId is created and then say you have a saving and a checking account under Citibank then both these accounts will have an unique identifier called itemAccountId.
Hence the transaction search takes itemAccountId as the parameter and will return transaction only for that account.
Please use below API to get ItemAccountId and pass it to the transaction Search.
https://developer.yodlee.com/Aggregation_API/Aggregation_Services_Guide/Aggregation_REST_API_Reference/getItemSummaryForItem1