-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Callback parameters #1
Comments
Hi @ZKRYLN , The Coinbase Commerce documentation isn't quite clear on what to return. Basically, what I've done is return an HTTP 200 status code and seems to work.
Let me know if you have any other issues. Thanks, 👨 🏁 "Louie Louie, oh no... Me gotta go... Aye-yi-yi-yi, I said" |
In more detail for completeness, here is the code I use: [Route("some_route/webhook"), HttpPost]
public ActionResult Coinbase_Webhook()
{
var requestSignature = Request.Headers[HeaderNames.WebhookSignature];
Request.InputStream.Seek(0, SeekOrigin.Begin);
var json = new StreamReader(Request.InputStream).ReadToEnd();
if (!WebhookHelper.IsValid(SHARED_SECRET, requestSignature, json)){
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
var webhook = JsonConvert.DeserializeObject<Webhook>(json);
if (webhook.Event.IsChargeConfirmed)
{
var charge = webhook.Event.DataAs<Charge>();
if (charge.Name == "PRODUCT_NAME")
{
//THE PAYMENT IS SUCCESSFUL
//DO SOMETHING TO MARK THE PAYMENT IS COMPLETE
//IN YOUR DATABASE
}
}
return new HttpStatusCodeResult(HttpStatusCode.OK);
} 🚶♀️ 👌 Danelle & Salda - Nobody |
Hi @bchavez, |
hi, Response.Data.HostedUrl, can I open this address in iframe or modal? I could not find it in the documents and my english is a little bad. sorry var url = response.Data.HostedUrl; the server did not allow. regards. |
Hi @ZKRYLN , Thanks a lot for your donation. I appreciate it :) As for your question: No, you cannot embed using an IFRAME due to Coinbase Commerce CSP:
As you saw, the server instructs the browser not to allow it. The best you can do is send a full page redirect: var order = new CreateCharge
{
Name = "PRODUCT_NAME",
Description = "PRODUCT_DESCRIPTION",
PricingType = PricingType.FixedPrice,
LocalPrice = new Money
{
Amount = 3.00,
Currency = "USD"
},
Metadata =
{
{"purchaseId", PURCHASE_ID}
},
RedirectUrl = "https://mysite.com/some_route/complete"
};
var response = await this.CommerceApi.CreateChargeAsync(order);
return Redirect(response.Data.HostedUrl); Notice how the [Route( "some_route/complete" ), HttpGet]
public ActionResult Coinbase_Complete()
{
//DISPLAY THE CHECKOUT COMPLETED VIEW
return View( "Complete" );
} Hope that helps! 🚶♂️ 🚶♀️ Missing Persons - Walking in L.A. |
hi @bchavez |
Hi @ZKRYLN, I have the same problem too. I wasn't able to find a way to add a I suspect this is maybe by design or a problem with their API. You'll probably have to talk to them directly to find out if Try sending email to [email protected] for support, posting on stack overflow, or using their support site. If you find the answer, please let me know too. I would like to know if the |
HttpContext does not contain a definition of InputStream. How to solve this |
var requestSignature = Request.Headers[HeaderNames.WebhookSignature]; Request.InputStream.Seek(0, SeekOrigin.Begin); var json = new StreamReader(Request.InputStream).ReadToEnd(); HttpContext does not contain a definition of InputStream. How to solve this |
@chuksgpfr , you'll have to find where the input stream is for the request body in your version of ASP.NET. MVC5 or ASP.NET Core. The Hope that helps, |
|
Hello, I'm doing the payment successfully, but I have not found which parameter to return in the callback address.
regards respects.
Webhook subscriptions : https://mysite.com/home/callback
public ActionResult callback(string ????)
{
// or Request.Form.Get("????");
try
{
var webhook = JsonConvert.DeserializeObject(????);
..............
The text was updated successfully, but these errors were encountered: