Missing external_id in item.update web hook event - webhooks

We're not seeing external ID included in item.update webhook. The documentation says we should be included:
item.update: When an item is updated. Provides parameter "item_id", "item_revision_id" and "external_id".
The parameters we do see (via requestbin) are:
item_id: 12345
hook_id: 9875
type: item.update
item_revision_id: 2
What do we need to do to have external_id included in the webhook event? Or am I misreading the documentation?

Podio documentation is up-to-date and external_id parameter is sent for item.create and item.update hooks. In order to have it sent, item needs to have it :)
So, if you just create item from Podio web, that item won't have any external_id. But if you create item via API and specify external_id then it will be there.
Here is full example in Ruby:
attr = {:fields => { :title => 'Created with external ID'},
:external_id => 'exernal_id_for_demo' }
item = Podio::Item.create(app_id, attr)
Then webhook item.create will be:
item_id: 720040614
item_revision_id: 0
type: item.create
hook_id: 7243151
external_id: exernal_id_for_demo

I don't think Podio provide external_id with the hook data. What you should do is do another call 'Get item revision difference' with item_revision_id as the revision_to_id. This will give you the current revision details. And you can find the external_id and field_id in this response.

Rather than receive the external_id, we can register a hook to be triggered only against a particular field. This way, the URL that's triggered can encode which external_id was involved.
The gotcha is that you can't do this from the management interface, but you can from the API. For example, using HTTPie, if we had a field with an id of 123...
http POST https://api.podio.com/hook/app_field/123/ \
url=http://your.endpont/123
type=item.update
'Authorization: OAuth2 token-here'
...which returns the hook_id, and you'd validate the hook as usual.
Via: https://stackoverflow.com/a/39782472/154248

Related

stripe - find out which payment method did customer use

I'm using two different payment methods in my Stripe checkout, 'card' and 'sofort'.
For statistics purposes, I want to find out which payment method did my customer use after payment succeeded.
I had a look at the session I get back after checkout. But I couldn't find any useful information.
Did anyone solved this issue? Thanks
EDIT (Solution in Java):
RequestOptions requestOptions = RequestOptions.builder().setStripeAccount(retrieveKey("CONNECTED_ACCOUNT_ID")).build();
PaymentIntent paymentIntent = PaymentIntent.retrieve(paymentIntentID, requestOptions);
List<Charge> charges = paymentIntent.getCharges().getData();
for (Charge cg : charges) {
paymentMethodType = cg.getPaymentMethodDetails().getType();
}
If you're using Checkout, the returned session object will include the associated payment_intent ID, which can be used with Retrieve a PaymentIntent.
When retrieving the PaymentIntent you can optionally 'expand' the payment_method field, which will return the full pm_ object associated with the payment. This will include all details, including type field.
This will differ depending on your language/integration. Using Node.js:
stripe.paymentIntents.retrieve('pi_XXX', {
expand: ['payment_method'],
});

How to use the function transaction.retrieve() to get receipt data?

I am developing a transaction workflow capsule, and I use the function transaction.retrieve() to get order data from the platform. But it returns only part of the order data.
MyReceipt is a structure stored the order informations, it is defined like this:
structure (MyReceipt) {
description (order info)
// properties
features { activity}
}
And it is built as a output concept of Commit Action, like this
action (CommitRequest) {
type (Commit)
description ()
collect {
// MyRequest
}
output (MyReceipt)
}
I try to get data like this
transaction.retrieve("bixby.MyCapsule.MyReceipt")
It is supposed to return all the MyReceipt Data. But it return only part of the Receipt data.Is it right to get all the orders? Or is there other ways to get all the receipt data?
And I have found the sample code use it just like this to get the last Receipt data
transaction.retrieve("bixby.MyCapsule.MyReceipt", "ALL", 1)
but it doesn't explain what these two parameter "ALL" and 1 represent for. And I want to get more details about the usage of this function.
Could you plz tell me how to use the function transaction.retrieve() or other function to get all the Receipt historical data, and How can I check out the transaction data for someone when I try to find the cause of the issue.
Copy the answer from dogethis. (Thanks, man! You do the hard work, I took credit)
We have the DOC ready online here
Basically, ALL is the default to get all state of transaction data, and 1 means only one record. The API page was not there before, so thanks for let us know.
I think it's the 1 cause you not get all record, but it does has a limit 20...
Have fun with Bixby!

Stripe: Getting Credit Card's Last 4 Digits

I have upgraded the Stripe.net to the latest version which is 20.3.0 and now I don't seem to find the .Last4 for the credit card. I had the following method:
public void CreateLocalCustomer(Stripe.Customer stipeCustomer)
{
var newCustomer = new Data.Models.Customer
{
Email = stipeCustomer.Email,
StripeCustomerId = stipeCustomer.Id,
CardLast4 = stipeCustomer.Sources.Data[0].Card.Last4
};
_dbService.Add(newCustomer);
_dbService.Save();
}
But now the stipeCustomer.Sources.Data[0].Card.Last4 says 'IPaymentSource' does not contain a definition for 'Card'. Does anyone know how I can get the card details now? The flow is that I create the customer by passing the Stripe token to Stripe, then I get the above stripeCustomer. So I expect it to be somewhere in that object. But I can't find it. The release notes can be found here.
Thank you.
In the old world of Stripe, there only used to be one type of payment method you could attach to a Customer; specifically, Card-objects. You would create a Card-object by using Stripe.js/v2 or the Create Token API Endpoint to first create a Token-object and then attach that token to a Customer-object with the Create Card API Endpoint.
Once Stripe expanded to support a number of other payment methods though, Stripe built support for a new object type that encapsulated a number of payment methods (including credit cards) called Source-objects. A Source-object is created either by using Stripe.js/v3 or the Create Source API Endpoint. It can also be attached to a Customer-object in much the same way as the Card-objects mentioned above, except they retain their object type. They're still a Source. You use the Attach Source API Endpoint to do this (that is notably identical to the Create Card API Endpoint mentioned above).
What I'm getting at here, is there are now two different object types (or more) that you can expect to see returned in the sources-array (or Sources in .NET). All of these methods though inherit from the IPaymentSource-interface. So if you know you have a Card-object getting returned, you can simply cast the returned object to the Card-class.
Something like this should get you going:
CardLast4 = ((Card) stipeCustomer.Sources.Data[0]).Last4
You can see what I mean by inheritance by looking at this line in the Card-class file:
https://github.com/stripe/stripe-dotnet/blob/master/src/Stripe.net/Entities/Cards/Card.cs#L7
Good luck!
As of Stripe.net.21.4.1, this is what works:
var chargeService = new ChargeService();
var charge = chargeService.Get(id);
CardLast4 = ((Card)charge.Source).Last4;
It's getting hard not to panic when code breaks because of all the micro-changes Stripe makes.
So after debugging, it looks like the Data[0] needs to be cast as Card to get the card.
So it will be CardLast4 = ((Card)stipeCustomer.Sources.Data[0]).Last4.

Retrieving line items from Braintree Transactions

The Braintree Transaction API has a field for lineItems, but how do I use it? The Transaction response doesn't return line items, and there are no lineitems int the control panel for transactions either.
It looks like the line items aren't actually stored anywhere. Am I right? If so, what's the point of them?
I want to show customers an itemised receipt of the transaction (which is a really obvious use case, right?). Is there anyway to get Braintree to generate this as part of the transaction?
I'm using version 2.5 of the Braintree Node.js SDK.
I'm not sure if this was the case a month ago when you asked the question, but it seems that the transaction response does return line items:
https://developers.braintreepayments.com/reference/response/transaction/node#line_items
UPDATED ANSWER
As of version 2.6.0 of the Braintree Node SDK, lineItems is an attribute of the Transaction response object. See Braintree's associated documentation here.
ORIGINAL ANSWER
You may use gateway.transactionLineItem.findAll(someTransactionId, function(err, response) {}) to retrieve the line items associated with a transaction. This is documented in the tests of the SDK:
specHelper.defaultGateway.transactionLineItem.findAll(response.transaction.id, function (err, response) {
assert.equal(response.length, 1);
let lineItem = response[0];
assert.equal(lineItem.quantity, '1.0232');
assert.equal(lineItem.name, 'Name #1');
assert.equal(lineItem.kind, 'debit');
assert.equal(lineItem.unitAmount, '45.1232');
assert.equal(lineItem.totalAmount, '45.15');
done();
});
We are in the process of updating our developer docs and Control Panel to reflect this behavior.

Foursquare API error No venues or groups specified returned when adding campaign

Using the Foursquare Merchant API, I'm trying to add a campaign. I am able to add a special successfully. However, when using the special's id and adding a campaign, I receive the following error, "Foursquare2::APIError: other: No venues or groups specified. (400)".
Even after specifying both the specialId and venueId, I receive the same error. Although the foursquare docs state that only the specialId is required.
I am using the Foursquare2 ruby wrapper gem with my code additions to add a campaign
def add_campaign(options={})
response = connection.post do |req|
req.url "campaigns/add", options
end
return_error_or_body(response, response.body.response.campaign)
end
Having receiving a client object from the foursquare gem. I use the below code
client.add_campaign(:specialId => specialId, :venueId => venueId)
Any thoughts on why this is causing an error?
venueIds and groupIds are not individually required, but one of them must be provided. I'll update the documentation to make this clearer. Thanks for pointing this out!

Resources