Getting Started in 60 Seconds

These steps will guide you on how to display the Amazon Checkout button.

  1. Add the following line to the _AppStart.cshtml page of your WebMatrix Site (if the file does not already exist, create it in the root of the website).
    Note: the Merchand Id, awsAccessKeyId and secretKeyId must be provided. For instructions on how to provision a Seller Central account and obtain these parameters, you can read the Integration Guide for Checkout by Amazon
    @{
      AmazonCheckout.Initialize("{merchand-key}", awsAccessKeyId:"XXX", secretKeyId:"XXX");    
    }
    					
  2. In any WebMatrix page, add the following code to display the Checkout button:
    @AmazonCheckout.GetAmazonButton("productName",
                                "description",
                                10,  //Price:  must be a decimal value.
                                "imageUrl",
                                5,   //Weight: must be a double value.
                                "categoryName", 
                                "promotionId", 
                                "amazonCondition", 
                                "amazonTaxTableId",
                                )
    
                        

These steps will guide you on how to add Shopping cart functionallity

  1. Add the following line to the _AppStart.cshtml page of your WebMatrix Site (if the file does not already exist, create it in the root of the website).
    Note: the Merchand Id, awsAccessKeyId and secretKeyId must be provided. For instructions on how to provision a Seller Central account and obtain these parameters, you can read the Integration Guide for Checkout by Amazon
    @{
      AmazonCheckout.Initialize("{merchand-key}");    
    }
    					
  2. It makes sense to put an access button to the shopping cart in the head section. To do this, in the _SiteLayout.cshtml, on the Head section add the following code:
    @AmazonCheckout.GetShoppingCart()
    
    		
  3. Below every product item, add the following code to show the "Add to shopping cart" button:
    @AmazonCheckout.GetAmazonButton("productName",
                                "description",
                                10,  //Price:  must be a decimal value.
                                "imageUrl",
                                5,   //Weight: must be a double value.
                                "categoryName", 
                                "promotionId", 
                                "amazonCondition", 
                                "amazonTableId"
                                )
    
                        
Running the Amazon Checkout Helper Sample

Optionally, you can download a sample WebMatrix web site where you can see the helper in action. This sample also demonstrates how to handle a Checkout By Amazon and the Shopping Cart functionallity. To download and run it with Microsoft WebMatrix, follow these steps:

  1. Download the sample site from the helper's Codeplex site, Downloads section. Extract the contents and open the folder in WebMatrix.
  2. Update the _AppStart.cshtml file to replace the following placeholders:
    1. Replace the {yourMerchantId} placeholder with the Merchant Id you can find in the Seller Central site.
    2. Replace the {yourAwsAccessKey} placeholder with the AWS Access Key you can find in the Seller Central site.
    3. Replace the {yourAwsSecretKey} placeholder with the AWS Secret Key you can find in the Seller Central site.
    4. Replace the {yourAssociateTag} placeholder with the Associate Tag Key you can find in the Seller Central site.
  3. Configure the site URL to match the ReturnUrl configured in Seller Central. To do this, perform the following steps:
    1. From the Seller Central site, configure the return URL to <yourSiteUrl>\Thankyou.cshtml, replacing the <yourSiteUrl> with the URL of your site. For more information on how to configure the return URL in Seller Central you can read the Integration Guide for Checkout by AmazonNOTE: For development purposes, you can use 127.0.0.1:8088 as your site URL.
  4. In the Web Matrix, in the right menu, click the Site option.
  5. In the right menu, click the Settings option.
  6. In the Settings main content page, set the site URL to <yourSiteUrl>

You can find more information about the Amazon API in https://payments.amazon.com/sdui/sdui/helpTab .

Last edited Apr 12, 2011 at 6:41 AM by drewby, version 2

Comments

No comments yet.